I'm quite new to R and working on conditions in R language. I have a dataframe looking like this :
ID nb
11 1
11 2
11 3
24 1
24 2
32 1
41 1
41 2
And I want to subset rows where nb = max(nb) for each different ID, and so get this new dataframe :
ID nb
11 3
24 2
32 1
41 2
If possible is there a way to do this without a loop ?
Thank you for your help