get_us_regional_cases.Rd
Fetches daily COVID cases by state or county collated by the New York Times Data is available at https://github.com/nytimes/covid-19-data
get_us_regional_cases(level = "state", out = "timeseries")
level | Character String specifying admin level "state", "county", default: "state". |
---|---|
out | Character String specifying output data format "timeseries", "total", default: "timeseries". |
A data.frame of COVID cases by region in the US
get_us_regional_cases(level = 'state', out = 'timeseries')#> # A tibble: 4,689 x 5 #> date state fips cases deaths #> <date> <chr> <chr> <dbl> <dbl> #> 1 2020-01-21 Washington 53 0 0 #> 2 2020-01-22 Washington 53 0 0 #> 3 2020-01-23 Washington 53 0 0 #> 4 2020-01-24 Illinois 17 0 0 #> 5 2020-01-24 Washington 53 0 0 #> 6 2020-01-25 California 06 0 0 #> 7 2020-01-25 Illinois 17 0 0 #> 8 2020-01-25 Washington 53 0 0 #> 9 2020-01-26 Arizona 04 0 0 #> 10 2020-01-26 California 06 1 0 #> # … with 4,679 more rowsif (FALSE) { regions <- rnaturalearth::ne_states("United States of America", returnclass = "sf") cases <- get_us_regional_cases(out = 'total') regions %>% dplyr::filter(name %in% cases$state) %>% ggplot2::ggplot() + ggplot2::geom_sf() }