Unlike questions I've found, I want to get the unique of two columns without order.
I have a df:
df<-cbind(c("a","b","c","b"),c("b","d","e","a"))
> df
[,1] [,2]
[1,] "a" "b"
[2,] "b" "d"
[3,] "c" "e"
[4,] "b" "a"
In this case, row 1 and row 4 are "duplicates" in the sense that b-a is the same as b-a.
I know how to find unique of columns 1 and 2 but I would find each row unique under this approach.
unique(df)
would do the trick. Trydf<-data.frame(c("a","b","c","b"),c("b","d","e","a"))
first.unique(df)
doesn't check across columns to see thatc('a','b')
is effectively the same asc('b','a')
(and why should it?). Slightly more work ...