[R] extract subset of data.frame

syrvn mentor_ at gmx.net
Thu Feb 23 16:48:51 CET 2012


consider the following data.frame df and vector v

df <- data.frame(group = c("A","B","C","D"), value = c(1,2,3,4))
v <- c(2,3)

How can I return a sub data.frame which has only the rows left where value
matches v


group value
B 2
C 3


View this message in context: http://r.789695.n4.nabble.com/extract-subset-of-data-frame-tp4414251p4414251.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list