Trying to filter gapminder data over time.

You can achieve this with a grouped filter with any(), such as:

plotData %>%
  group_by(country) %>%
  filter(any(rank <= 15)) %>%
  ungroup()
2 Likes