Hi Monnand,
Is this what you are looking for?
data[grep("prefix1",data$name),]
data[grep("prefix2",data$name),]
Jim
On Wed, Jan 28, 2015 at 6:51 PM, Monnand wrote:
> Hi all,
>
> This really annoyed since I thought this would be easy with some higher
> order function.
>
> Here is what I want:
>
Thank you all!! :-)
rlearner309 wrote:
>
> I have a question about how to filter the data frame:
> Suppose my data frame has variables like gender, age,... How to get a
> subset of the data frame, with only female (or male) and/or age > 50...?
> What is the typical syntax? I tried several
Hi,
rlearner309 wrote:
I have a question about how to filter the data frame:
Suppose my data frame has variables like gender, age,... How to get a subset
of the data frame, with only female (or male) and/or age > 50...? What is
the typical syntax? I tried several condition expressions, but non
Ooops ! Thanks.
--- On Tue, 7/22/08, Peter Dalgaard <[EMAIL PROTECTED]> wrote:
> From: Peter Dalgaard <[EMAIL PROTECTED]>
> Subject: Re: [R] How to filter a data frame?
> To: [EMAIL PROTECTED]
> Cc: r-help@r-project.org, "rlearner309" <[EMAIL PROTECTED]>
May be this help you; Just intall.packages("sqldf", dependencies=T)
require(sqldf)
my_df<-data.frame(cbind(gender=sample(c("male","female"),50,replace=T),
age=round(rnorm(50, mean=30, sd=5),0)))
my_df_subset_male<-sqldf("select * from my_df where gender=='male'")
my_df_subset_male
my_df_subset_
John Kane wrote:
?subset
Is this what you want?
subset(dataset, gender="M" | age < 50)
In case you didn't see it: Make that
gender == "M" | age < 50
--
O__ Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
on 07/22/2008 08:47 AM rlearner309 wrote:
I have a question about how to filter the data frame:
Suppose my data frame has variables like gender, age,... How to get a subset
of the data frame, with only female (or male) and/or age > 50...? What is
the typical syntax? I tried several condition ex
?subset
Is this what you want?
subset(dataset, gender="M" | age < 50)
--- On Tue, 7/22/08, rlearner309 <[EMAIL PROTECTED]> wrote:
> From: rlearner309 <[EMAIL PROTECTED]>
> Subject: [R] How to filter a data frame?
> To: r-help@r-project.org
> Received: Tuesday, July 22, 2008, 9:47 AM
> I hav
8 matches
Mail list logo