View source: R/download_jhu_csse_covid19_data.R
download_jhu_csse_covid19_data | R Documentation |
Downloads Johns Hopkins University CSSE data on the spread of the SARS-CoV-2 virus and the Covid-19 pandemic (https://github.com/CSSEGISandData/COVID-19). The data for confirmed cases, reported deaths and recoveries are merged into one data frame, converted to long format and joined with ISO3c (ISO 3166-1 alpha-3) country codes based on the countrycode package. Please note: JHU stopped updating the data on March 10, 2023.
download_jhu_csse_covid19_data(
type = "country",
silent = FALSE,
cached = FALSE
)
type |
The type of data that you want to retrieve. Can be any subset of
|
silent |
Whether you want the function to send some status messages to
the console. Might be informative as downloading will take some time
and thus defaults to |
cached |
Whether you want to download the cached version of the data
from the tidycovid19 Github repository instead of retrieving the
data from the authorative source. Downloading the cached version is
faster and the cache is updated daily. Defaults to |
If only one type
was selected, a data frame containing the
data. Otherwise, a list containing the desired data frames ordered as
in type
.
df <- download_jhu_csse_covid19_data(silent = TRUE, cached = TRUE)
df %>%
dplyr::group_by(country) %>%
dplyr::summarise(confirmed_cases = max(confirmed, na.rm = TRUE)) %>%
dplyr::arrange(-confirmed_cases) %>%
dplyr::top_n(10)
df <- download_jhu_csse_covid19_data(
type = "us_county", silent = TRUE, cached = TRUE
)
df %>%
dplyr::filter(!is.na(state)) %>%
dplyr::group_by(state) %>%
dplyr::summarise(deaths = max(deaths, na.rm = TRUE)) %>%
dplyr::arrange(-deaths) %>%
dplyr::top_n(10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.