Making a sub data.frame
Try this:
x
ID VAR1 1 11 blaaal 2 121 blalda 3 121 adada 4 234 baada 5 231 ddaaa 6 231 baada
idm <- c(121,234,231) subset(x, ID %in% idm)
ID VAR1 2 121 blalda 3 121 adada 4 234 baada 5 231 ddaaa 6 231 baada
On Mon, Jul 27, 2009 at 4:40 PM, desper<idesper at gmail.com> wrote:
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.
Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?