0

I have a data frame that looks as follows:

df <- data.frame(x = c('a', 'b', 'c', 'd'), 
                 y = c('b', 'a', 'c', 'c'), 
                 z = c(1, 1, 1, 4))

I would like to identify duplicate cases/rows. Seems like simple task I thought I should be able to tackle via duplicates or unique. Not so much, unless I'm missing something obvious here.

I would like to return a data frame where case 1 (a-b) and case 2 (b-a) are recognized as the same. In other words, the result of this should be

x y z
a b 1
c c 1
d c 4

I don't care which case, 1 or 2, gets returned, so long as there is only one.

Any help would be much appreciated!

0 Answers0