covid19 {COVID19}R Documentation

COVID-19 Data Hub


Download COVID-19 data from


  country = NULL,
  level = 1,
  start = "2010-01-01",
  end = Sys.Date(),
  vintage = NULL,
  wb = NULL,
  gmr = NULL,
  amr = NULL,
  dir = tempdir(),
  verbose = TRUE,



vector of country names or ISO codes (ISO 3166-1 Alpha-2 code, Alpha-3 code, or numeric code). By default, downloads data for all countries.


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

start, end

the start and the end date of the period of interest. The data are subsetted to match this time range.


date. This parameter allows to retrieve the snapshot of the dataset that was available on the given date. This typically differs from subsetting the latest data, as most governments are updating the data retroactively. Available since 2020-04-14.


character vector of World Bank indicator codes. See details.


link to the Google Mobility Report dataset, or TRUE. See details.


link to the Apple Mobility Report dataset. See details.


folder where the data files are to be downloaded.


logical. Print on progress? Default TRUE.


backward compatibility, not used.


Country-level covariates by World Bank Open Data can be added via the argument wb. This is a character vector of indicator codes to download. The codes can be found by inspecting the corresponding URL. For example, the code of the indicator "Hospital beds (per 1,000 people)" available at is SH.MED.BEDS.ZS. The indicators are typically available at a yearly frequency. This function returns the latest data available between the start and the end date. See the table at the bottom of this page for suggested indicators.

Mobility data by Google Mobility Reports can be added via the argument gmr. This is the link to the Google "CSV by geographic area" ZIP folder. At the time of writing, the link is As the link has been stable since the beginning of the pandemic, the function accepts gmr=TRUE to automatically use this link.

Mobility data by Apple Mobility Reports can be added via the argument amr. This is the link to the Apple "All CSV data" file. This link is changing constantly. Consider downloading the data file from the website first, and then set amr="path/to/file.csv"

Refer to this webpage for the details on the data sources, and see the changelog for the latest news about the dataset.


data.frame. See the dataset documentation


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



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


## Not run: 

# Worldwide data by country
x <- covid19()

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

# Data for specific countries by county/province
x <- covid19(c("Italy", "US"), level = 3)

# Retrieve the data that were available on 15 May, 2020
x <- covid19(vintage = "2020-05-15")

# Download the files in the folder "data"
x <- covid19(dir = "data")

# World Bank data
wb <- c("gdp" = "NY.GDP.MKTP.CD", "hosp_beds" = "SH.MED.BEDS.ZS")
x  <- covid19(wb = wb)

# Google Mobility Reports
x <- covid19(gmr = TRUE)

# Apple Mobility Reports
# - download the CSV data file from
# - use the path to the file that you have downloaded
x <- covid19(amr = "path/to/file.csv")

## End(Not run)

[Package COVID19 version 3.0.0 Index]