Take a look at ?merge for doing such join operations. (I believe that should help) If you had provided a sample of your datasets using dput, I would have checked that for you.
-----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of song song Sent: 02 November 2010 11:44 To: r-help@r-project.org Subject: [R] how to compare two datasets in R>? hi, everybody, my question is: suppose I have two data sets, set A is large and have variables like ID, Gender, Income. Set B is small and suppose only has ID. Now I want to get a subset from data set A which contains ID from Set B. How to do this in R>? Is there any commands to do this? Thank you [[alternative HTML version deleted]] ______________________________________________ R-help@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. ______________________________________________ R-help@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.