The R Project SVN R

Rev

Rev 59039 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 59039 Rev 61150
Line 82... Line 82...
82
 
82
 
83
with(airquality, subset(Ozone, Temp > 80))
83
with(airquality, subset(Ozone, Temp > 80))
84
 
84
 
85
## sometimes requiring a logical 'subset' argument is a nuisance
85
## sometimes requiring a logical 'subset' argument is a nuisance
86
nm <- rownames(state.x77)
86
nm <- rownames(state.x77)
87
start_with_M <- nm \%in\% grep("^M", nm, value=TRUE)
87
start_with_M <- nm \%in\% grep("^M", nm, value = TRUE)
88
subset(state.x77, start_with_M, Illiteracy:Murder)
88
subset(state.x77, start_with_M, Illiteracy:Murder)
89
# but in recent versions of R this can simply be
89
# but in recent versions of R this can simply be
90
subset(state.x77, grepl("^M", nm), Illiteracy:Murder)
90
subset(state.x77, grepl("^M", nm), Illiteracy:Murder)
91
}
91
}
92
\keyword{manip}
92
\keyword{manip}