I have a data.frame
with only three columns but with many thousands of rows. The first and the second columns report numerical ID, and their combination indicate a link (e.g. A-B equal to B-A).
Now, I'd like to delete all rows that are duplicates for the link, selecting the row with the highest value in the third column.
Below a short example:
My input data.frame
:
1 2 100
102 100 20000
100 102 23131
10 19 124444
10 15 1244
19 10 1242
10 19 5635
2 1 666
1 2 33
100 110 23
what I aim to get:
100 102 23131
10 19 124444
10 15 1244
2 1 666
100 110 23
I' trying to find the solution in R
, otherwise postgreSQL
would be fine too.
Thanks a lot!