简体   繁体   中英

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

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)]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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