Re: [R] How to filter a data frame with user defined function?

2015-01-28 Thread Jim Lemon
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 monn...@gmail.com wrote: Hi all, This really annoyed since I thought this would be easy with some higher order function. Here is what I

Re: [R] How to filter a data frame?

2008-07-22 Thread John Kane
?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 have a

Re: [R] How to filter a data frame?

2008-07-22 Thread Marc Schwartz
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

Re: [R] How to filter a data frame?

2008-07-22 Thread Peter Dalgaard
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 (*)

Re: [R] How to filter a data frame?

2008-07-22 Thread milton ruser
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

Re: [R] How to filter a data frame?

2008-07-22 Thread Roland Rau
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

Re: [R] How to filter a data frame?

2008-07-22 Thread rlearner309
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