[R] how to compare two datasets in R>?
David Winsemius
dwinsemius at comcast.net
Tue Nov 2 08:03:36 CET 2010
On Nov 2, 2010, at 2:14 AM, song song wrote:
> 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.
Try:
A[A$ID %in% B$ID, ]
Or:
subset(A, ID %in% B$ID)
>
> How to do this in R>? Is there any commands to do this?
>
> Thank you
>
> [[alternative HTML version deleted]]
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list