df <- data.frame(id=c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3),
x=c(1,2,3,3,5,1,4,3,1,2,8,9,3,1,0))
For each group, if I want to filter the first row
df %>%
group_by(id) %>%
filter(row_number()==1)
What do I do if I have to filter the most middle row?