Hi, I have output from snp-dists (https://github.com/tseemann/snp-dists) in molten format, e.g.:

    seq1    seq2    1
    seq1    seq3    2
    seq2    seq1    1
    seq2    seq3    3
    seq3    seq1    2
    seq3    seq2    3

The third column gives the number of SNPs between the pair of sequences given in columns 1 and 2. As you can see, these values are duplicated, as it shows both the combination seq1 seq2 and seq2 seq1. How can I (in R or bash preferably) remove the duplicate values?
Using **awk**:

    $ awk '!(seen[$1,$2]++ || seen[$2,$1]++)' test.txt
    seq1 seq2 1
    seq1 seq3 2
    seq2 seq3 3

Using **R**:

    # example data
    x <- read.table(text = "seq1    seq2    1
    seq1    seq3    2
    seq2    seq1    1
    seq2    seq3    3
    seq3    seq1    2
    seq3    seq2    3")
    
    # sort column values, then get unique
    unique(data.frame(c1 = pmin(x$V1, x$V2), c2 = pmax(x$V1, x$V2), value = x$V3))
    #     c1   c2 value
    # 1 seq1 seq2     1
    # 2 seq1 seq3     2
    # 4 seq2 seq3     3

Using **R** again, a bit simpler and scales better when we have more than 2 columns, ([Related StackOverflow post](https://stackoverflow.com/q/9028369/680068)):

    x[ !duplicated(apply(x[, 1:2], 1, sort), MARGIN = 2), ]


