The code would be something like this
library(lubridate)
library(dplyr)
r %>%
mutate(date = dmy(date)) %>%
group_by(continent, location) %>%
filter(date == max(date)) %>%
group_by(continent) %>%
summarise(population = sum(population))
As I said before, If you need more specific help, please provide a proper REPR oducible EX ample (reprex) illustrating your issue.