查找在R中的data.table中出现多次的值对

hi1*_*i15 4 r data.table

我有一个data.tableR

> head(d)
   COUNT       SAMPLE     junction
1:     1          R1     tup
2:     1          R1     tup
3:     1          R1     tai
4:     1          R2     milt
5:     2          R3     Bsg25D
6:     1          R4     tutl
Run Code Online (Sandbox Code Playgroud)

与维度

> dim(d)
[1] 1685992       3
Run Code Online (Sandbox Code Playgroud)

现在我想找出在数据表中出现多次的对(SAMPLE,junction).例如,对(R1,tup)发生不止一次

akr*_*run 6

你可以试试

library(data.table)
d[,.N>1 ,list(SAMPLE, junction)]
Run Code Online (Sandbox Code Playgroud)