I have a dataframe below:
A B C
ab Small 1
ab Medium 2
ab Large 9
cd Small NA
cd Medium 10
cd Large 20
How do I aggregate this so that I take the max by group: column A and B?
I want the final result to look like this:
A B C
ab Large 9
cd Large 20
I already tried:
trial<-df %>% group_by(A, B) %>% summarise(Value = max(C))
I want to take the max of column B by group A. So for example, the maximum of column B within column A: "ab" is 9 and the value of column B is Large.
Any help would be great. Thanks!