找到在R中的data.table中出现多次的值对 [英] Finding value pairs that occur more than once in a data.table in R
本文介绍了找到在R中的data.table中出现多次的值对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 R中有一个
data.table
R
>头(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
> dim(d)
[1] 1685992 3
现在我想找出对(SAMPLE,结点),在数据表中多次出现。例如,对(R1,tup)多次出现
解决方案
您可以尝试
<$ c $ p>
library(data.table)
d [,N> 1,list(SAMPLE,junction)]
I have a data.table
in R
> 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. For example, the pair (R1,tup) occures more than once
解决方案
You can try
library(data.table)
d[,.N>1 ,list(SAMPLE, junction)]
这篇关于找到在R中的data.table中出现多次的值对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文