Unified datasets for a better understanding of COVID-19.

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

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 TRUE. 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.

debug

logical. Warnings and stop on failure? Default FALSE.

Source

https://covid19datahub.io

Value

Grouped tibble (data.frame)

Details

If raw=FALSE, 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.

Note

We have invested a lot of time and effort in creating COVID-19 Data Hub, please:

References

Guidotti, E., Ardia, D., (2020), "COVID-19 Data Hub", Journal of Open Source Software 5(51):2376, doi: 10.21105/joss.02376 .

Examples

if (FALSE) { # 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") }