简体   繁体   English

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

[英]Finding value pairs that occur more than once in a data.table in R

I have a data.table in R 我在R有一个data.table

> 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

with dimension 与维度

> dim(d)
[1] 1685992       3

Now I want to find out the pairs (SAMPLE, junction) that occur more than once in the data table. 现在我想找出在数据表中出现多次的对(SAMPLE,junction)。 For example, the pair (R1,tup) occures more than once 例如,对(R1,tup)发生不止一次

You can try 你可以试试

library(data.table)
d[,.N>1 ,list(SAMPLE, junction)]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM