Suppose I have a data frame like this:
df <- data.frame(A = c(5, 5, 6, 6, 5), B = c(5, 5, 9, 9, 5), C = c(4, 1, 9, 1, 1))
A B C
5 5 4
5 5 1
6 9 9
6 9 1
5 5 1
If rows in the data frame have the same number in column B, then I only want to keep the row that has highest value in column C.
So according my condition, I am expected to get the filtered data frame like:
A B C
5 5 4
6 9 9
Thanks a lot!