Get last row of each group in R [duplicate]

You might try:

a %>% 
  group_by(ID) %>% 
  arrange(NUM) %>%  
  slice(n())

Leave a Comment