I have two columns in a data frame, and I have been able to delete all duplicate rows with unique( ) – Works a treat.
But now I want to delete rows were the values are the same, irrespective of which column they are in. like…
data1 data2
data3 data2
data2 data1
data2 data3
Should be simplified to
data1 data2
data3 data2
since rows 3 and 4 are the same as 1 and 2.
Any ideas?
First sort each row column-wise (using
applyandsort), then useunique: