data(coronavirus)
require(dplyr)
# Get top confirmed cases by state
coronavirus %>%
filter(type == "confirmed") %>%
group_by(country) %>%
summarise(total = sum(cases)) %>%
arrange(-total) %>%
head(20)
# Get the number of recovered cases in China by province
coronavirus %>%
filter(type == "recovered", country == "China") %>%
group_by(province) %>%
summarise(total = sum(cases)) %>%
arrange(-total)
Run the code above in your browser using DataLab