Suppose I have a data.table like this:
Table:
V1 V2
A B
C D
C A
B A
D C
I want each row to be regarded as a set, which means that B A and A B are the same. So after the process, I want to get:
V1 V2
A B
C D
C A
In order to do that, I have to first sort the table row-by-row and then use unique
to remove the duplicates. The sorting process is quite slow if I have millions of rows. So is there an easy way to remove the duplicates without sorting?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…