Is there a function that treats the elements of a row as set and returns only the first occurrence of each unique set?
In example below, rows 1 and 3 should be considered equal. It should be irrelevant for the function foo
whether an element is in col1
or col2
.
df <- data.frame(col1 = c('a', 'b', '1'), col2 = c('1', '2', 'a'))
foo(df)
> col1 col2
> 1 a 1
> 2 b 2