I have this dataframe.
A <- c('x','y','y','x')
B <- c(2,4,3,4)
example <- data.frame(A, B)
I would like to return the highest value (B) for each group in A, ie. return 4 for x and 4 for y. Hoping someone could help me write R code to do this. I am a beginner and first time poster, I apologise if this is a silly question!