The package includes functions to retrieve observed data from two canonical sources: the New York Times and the Center for Systems Science and Engineering (CSSE) at Johns Hopkins University. Both organizations administer data aggregation efforts that post daily COVID-19 case and death to GitHub. The data retrieval functions allow the user to specify "source" and "granularity" of data. Internally each function builds a path to the appropriate .csv file on GitHub, then reads the data into memory. The returned object is data aggregated weekly (using epiweek and epiyear designations) for available locations at the granularity specified (national, state, or county level).

get_cases(source = "jhu", granularity = "national")

get_deaths(source = "jhu", granularity = "national")

Arguments

source

Data source to query; must be one of 'jhu' or 'nyt'; default is 'jhu'

granularity

Data aggregation level; must be one of 'national', 'state', or 'county'; if data source is 'nyt' then only 'national' can be used currently; default is 'national'

Value

A tibble with (at minimum) the following columns:

  • epiyear: Epidemiological year (see epiyear for more details)

  • epiweek: Epidemiological week (see epiweek for more details)

  • icases/ideaths: Incident counts (cases or deaths)

  • ccases/cdeaths: Cumulative counts (cases or deaths)

If source = 'jhu' and granularity = 'state' then the location column will include the full name of the state. If source = 'jhu' and granularity = 'county' then the location column will include fips (county code).

References

https://github.com/CSSEGISandData/COVID-19

https://github.com/nytimes/covid-19-data