I have a data.frame test
that looks like the following:
> test <- data.frame(X=c(1, 3, 2, 1), Y=c(2, 2, 1, 3), Z=c("A", "B", "C", "D"))
> test
X Y Z
1 1 2 A
2 3 2 B
3 2 1 C
4 1 3 D
I want to be able to remove any row where there is an un-ordered duplicate pair. More specifically, where in the first row X = 1
and Y = 2
, it's un-ordered duplicate pair is found on the 3rd row where in this instance X = 2
and Y = 1
-- I'd like to remove the either entry of the two. The resulting data.frame should look like:
> final.test
X Y Z
1 1 2 A
2 3 2 B
4 1 3 D
Any help would be much appreciated :)