This question already has an answer here:
Imagine I have a data frame with three columns were column 1 and 2 depicts unique combination with a certain output 'value'. However, I want to filter out those rows were the columns are actually just swapped, since the outcome is the same and retain one outcome of one set of combination.
e.g. 2 - 1 = 1 and 1 - 2 = 1 is technically the same
df <- data.frame(column1 = c(2,3,4,1,3,4,1,2,4),
column2 = c(1,1,1,2,2,2,3,3,3),
value = c(1,2,10,1,2,4,2,2,5))
Since I don't have any reasonable code which can tackle this issue, I appreciate any help and hint!!