The stable release of this package is hosted on CRAN. The development version is available at Github.


Install the package:


Load the package


The only function in the package is covid19().

By default, the function downloads worldwide data by country:

x <- covid19()


The argument level specifies the granularity of the data:

  • 1: country-level data
  • 2: state-level data
  • 3: lower-level data

Download worldwide data by state:

x <- covid19(level = 2)


The argument country filters the data by country. This is a vector of country names or ISO codes (ISO 3166-1 Alpha-2 code, Alpha-3 code, or numeric code).

Download data for Italy and Unites States at county/province level:

x <- covid19(country = c("Italy", "US"), level = 3)

Time range

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

Download national-level data for United States from 01 October 2021 to 01 November 2021:

x <- covid19("US", start = "2021-10-01", end = "2021-11-01")


The parameter vintage 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 14 April, 2020.

Retrieve the data that were available on 15 May, 2020:

x <- covid19(vintage = "2020-05-15")

Download folder

The argument dir specifies the folder where the data files are to be downloaded. By default this is a temporary folder.

Download the files in the folder data:

x <- covid19(dir = "data")

World Bank Open Data

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. Example using GDP and number of hospital beds:

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

Google Mobility Reports

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.

x <- covid19(gmr = TRUE)

Apple Mobility Reports

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". Since v3.0.1 of the package, if amr=TRUE is provided, the function tries to detect the latest URL from this endpoint.

x <- covid19(amr = TRUE)

Star the repo

Help our package grow: star the repo!


Terms of use

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

The output data files are published under the CC BY license. All other code and assets are published under the GPL-3 license.

Cite as

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

A BibTeX entry for LaTeX users is:

    title = {COVID-19 Data Hub},
    year = {2020},
    doi = {10.21105/joss.02376},
    author = {Emanuele Guidotti and David Ardia},
    journal = {Journal of Open Source Software},
    volume = {5},
    number = {51},
    pages = {2376}

The implementation details and the latest version of the data are described in:

Guidotti, E., (2022), “A worldwide epidemiological database for COVID-19 at fine-grained spatial resolution”, Sci Data 9, 112, doi: 10.1038/s41597-022-01245-1

A BibTeX entry for LaTeX users is:

    title = {A worldwide epidemiological database for COVID-19 at fine-grained spatial resolution},
    year = {2022},
    doi = {10.1038/s41597-022-01245-1},
    author = {Emanuele Guidotti},
    journal = {Scientific Data},
    volume = {9},
    number = {1},
    pages = {112}