"Mark Na" <[EMAIL PROTECTED]> writes: > Dear R community, > > I have two dataframes "first" and "second" which share a unique identifier. > > I wish to make a new dataframe "third" retaining only the rows in > "first" which also occur in "second". > > I have tried using merge but can't seem to figure it out. Any ideas?
Doesn't sound like a merge problem. Will this do it?: first[first$ID %in% second$ID,] -- O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ [email protected] 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.
