How to output duplicated rows

前端 未结 6 1723
情话喂你
情话喂你 2020-12-04 03:39

I have the following data:

x1  x2  x3  x4
34  14  45  53 
2   8   18  17
34  14  45  20
19  78  21  48 
2   8   18  5

In rows 1 and 3; and

6条回答
  •  不知归路
    2020-12-04 04:23

    An alternative using ave:

    dat[ave(dat[,1], dat[-4], FUN=length) > 1,]
    
    #  x1 x2 x3 x4
    #1 34 14 45 53
    #2  2  8 18 17
    #3 34 14 45 20
    #5  2  8 18  5
    

提交回复
热议问题