I have the following dataframe, df:
studID Name
023 John
283 Mary
842 Jacob
211 Amy
and another dataframe, df_2:
studID
023
999
100
211
575
I want to subset the first dataframe, df so that it only contains the row values which the studID exists in the dataframe df_2.
So i would get:
studID Name
023 John
211 Amy
This dataframe would only contain John and Amy record since their studID is found in df_2.
I tried the following:
df_3 <- df[intersect(df$studID, df_2$studID),]
But I'm getting N/A values.