I want to select rows of data1 if the value of the first column exists in data2:
data1<-data.table(a=c(1,2,3,1),b=c(1,4,6,3))
data2<-data.table(a=c(1,3,1,5,6))
Desired output:
a b
1 1
3 6
1 3
The merge doesn't work as the keys are not unique, any other idea?
source
to share