I have a dataframe in R containing the columns ID.A, ID.B and DISTANCE, where distance represents the distance between ID.A and ID.B. For each value (1->n) of ID.A, there ma
One possibility:
myDF <- myDF[order(myDF$ID.A, myDF$DISTANCE), ] newdata <- myDF[which(!duplicated(myDF$ID.A)),]
Which gives :
ID.A ID.B DISTANCE 1 1 3 1.0 2 2 6 8.0 5 3 2 0.4 6 4 8 7.0 7 5 2 11.0