Learn R Programming

COVID19 (version 2.0.3)

covid19: COVID-19 Data Hub

Description

Unified datasets for a better understanding of COVID-19.

Usage

covid19(
  country = NULL,
  level = 1,
  start = "2019-01-01",
  end = Sys.Date(),
  raw = FALSE,
  vintage = FALSE,
  verbose = TRUE,
  cache = TRUE
)

Arguments

country

vector of country names or ISO codes (alpha-2, alpha-3 or numeric).

level

integer. Granularity level. 1: country-level data. 2: state-level data. 3: city-level data.

start

the start date of the period of interest.

end

the end date of the period of interest.

raw

logical. Skip data cleaning? Default FALSE. See details.

vintage

logical. Retrieve the snapshot of the dataset that was generated at the end date instead of using the latest version. Default FALSE.

verbose

logical. Print data sources? Default TRUE.

cache

logical. Memory caching? Significantly improves performance on successive calls. Default TRUE.

Value

Grouped tibble (data.frame)

Details

The raw data are cleaned by filling missing dates with NA values. This ensures that all locations share the same grid of dates and no single day is skipped. Then, NA values are replaced with the previous non-NA value or 0.

References

Guidotti, E., Ardia, D., (2020), "COVID-19 Data Hub", Working paper, 10.13140/RG.2.2.11649.81763.

Examples

Run this code
# NOT RUN {
# Worldwide data by country
x <- covid19()

# Worldwide data by state
x <- covid19(level = 2)

# Specific country data by city
x <- covid19(c("Italy","US"), level = 3)

# Data sources
s <- attr(x, "src")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab