On Apr 26, 2010, at 11:27 AM, Gabor Grothendieck wrote:
Here are four ways:
# state.name comes with R
DF <- data.frame(state = state.name, num = seq_along(state.name))
DF[DF$state %in% c("Iowa", "Utah"),]
subset(DF, state %in% c("Iowa", "Utah"))
subset(DF, grepl("Iowa|Utah", state))
John;
Here are four ways:
# state.name comes with R
DF <- data.frame(state = state.name, num = seq_along(state.name))
DF[DF$state %in% c("Iowa", "Utah"),]
subset(DF, state %in% c("Iowa", "Utah"))
subset(DF, grepl("Iowa|Utah", state))
library(sqldf) # see http://sqldf.googlecode.com
sqldf("select * f
See ?%in%
result$Subject %in% c("JEFF", "BG")
John Sorkin wrote:
I would like to select rows if a row contains any one of several values. I can
do the selection as follows:
result[,"Subject"]=="JEFF" | result[,"Subject"]=="BG"
But this is very unwieldily if one wishes to select many, many ro
On Apr 26, 2010, at 11:12 AM, John Sorkin wrote:
I would like to select rows if a row contains any one of several
values. I can do the selection as follows:
result[,"Subject"]=="JEFF" | result[,"Subject"]=="BG"
But this is very unwieldily if one wishes to select many, many rows
as one has
On Apr 26, 2010, at 10:12 AM, John Sorkin wrote:
> I would like to select rows if a row contains any one of several values. I
> can do the selection as follows:
>
> result[,"Subject"]=="JEFF" | result[,"Subject"]=="BG"
>
> But this is very unwieldily if one wishes to select many, many rows as
I would like to select rows if a row contains any one of several values. I can
do the selection as follows:
result[,"Subject"]=="JEFF" | result[,"Subject"]=="BG"
But this is very unwieldily if one wishes to select many, many rows as one has
to continuously repeat the source:
result[,"Subject"]
6 matches
Mail list logo