This is my dataframe
DF <- data.frame(plot=c(1,1,1,2,2,3,3,3), 
        id=c("A","B","A","B","B","C","B","C"),
        share=c(0.2,0.6,0.2,0.45,0.55,0.3,0.4,0.3))
What I need is to get per plot the id with the maximum share, so the final data frame would look like this:
max <- data.frame(plot=c(1,2,3),
         id=c("B","B","C"))
I know that there is a way with data.table and it will usually work, but I want to avoid it, because I need this inside of a function, and for some reason the function does not run with the data.table package loaded, because there are several functions of base R that overlap, so if possible I would like another approach.
 
     
    