How can I add a filter to list only the countries above x cases?

Asked

Viewed 47 times

0

confirmed <- read.csv('time_series_covid_19_confirmed.csv',
                      stringsAsFactors = FALSE)

library(dplyr)

covid <- confirmed %>% select(Country.Region, X3.29.20) %>%
  group_by(Country.Region) %>% 
  summarise(sum_X3.29.20 = sum(X3.29.20))

1 answer

1

Just add one filter at the end of the function:

library(dplyr)

covid <- confirmed %>% select(Country.Region, X3.29.20) %>%
  group_by(Country.Region) %>% 
  summarise(sum_X3.29.20 = sum(X3.29.20)) %>% 
  filter(sum_X3.29.20 > 500)

Thus, all countries with more than 500 cases of covid-19 will be considered.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.