I am trying to subset a large data frame based on matching IDs from another data frame. I read the answer to this question posted:
R: subset a data frame based on conditions from another data frame
However, my data differs from this in that for one of my data sets I have the linker ID set up in a column, and in the other, it goes across rows
Data set 1
*ID* time stat
*1* 3.21 6
*4* 7.9 3
...Data set 2
*ID 1 2 4* ...
y yellow brown yellow
z 3 5 2
a yes yes no
What I ultimately would like to get is a data frame where I only have the data from data set 2 that has a matching sample ID in data set 1. So in this example:
*ID 1 4* ...
y yellow yellow
z 3 2
a yes no
Any help is much appreciated.
Andrea