The purpose of this function is to enrich the JHU dataset with additional country-level metadata and then get the data into a form that can be easily written to excel or used as a "wide-format" tabular dataset.

jhu_data_to_excel(
  dat = jhu_data(),
  file = NA,
  cols_to_remove = c("callingCodes", "altSpellings", "latlng", "demonym", "timezones",
    "nativeName", "currencies", "languages", "translations", "flag", "regionalBlocs"),
  ...
)

Arguments

dat

a data.frame-like object with at least column CountryRegion that will be joined with country data.

file

character(1) filename to which to save excel file. If specified, use the write.xlsx() function from the openxlsx package to create (or overwrite) the file of that name. The excel file will have one tab for each of the subset records from the supplied data.frame in dat.

cols_to_remove

a character vector of column names from country_metadata() to remove.

...

passed to write.xlsx

Value

A list of three data.frames named deaths, confirmed, and recovered.

Note

This function is really a utility function to provide an excel format of data to folks more familiar with excel than with R.

Examples

xls_form = jhu_data_to_excel()
#> Error in curl::curl_fetch_memory(url, handle = handle): Timeout was reached: [restcountries.eu] Failed to connect to restcountries.eu port 443: Connection timed out
names(xls_form)
#> Error in eval(expr, envir, enclos): object 'xls_form' not found
head(xls_form[[1]])
#> Error in head(xls_form[[1]]): object 'xls_form' not found