[R] Making a sub data.frame

Bill.Venables at csiro.au Bill.Venables at csiro.au
Tue Jul 28 08:07:14 CEST 2009


Suppose DF is the data frame and someIDs is the vector

subDF <- subset(DF, ID %in% someIDs)


Bill Venables
http://www.cmis.csiro.au/bill.venables/ 


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of desper
Sent: Tuesday, 28 July 2009 6:41 AM
To: r-help at r-project.org
Subject: [R] Making a sub data.frame


Dear all,

I have a data.frame like this 

ID         VAR1
11           blaaal
121         blalda
121          adada
234        baada
231         ddaaa
231         baada
...           ...

and I have another vector of ID, say, c(121,234,231)
How could I collect all the observations start with ID from c(121,234,231) ?


Thanks

All the Best,
Desper
-- 
View this message in context: http://www.nabble.com/Making-a-sub-data.frame-tp24687873p24687873.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list