R6 Class containing specific attributes and methods for Covid19 Data Hub
Source:R/Covid19DataHub.R
Covid19DataHub.Rd
Attributes and methods for COVID-19 data provided by the Covid19 Data Hub
Details
This dataset supports both national and subnational data sources
with national level data returned by default. National data is sourced from
John Hopkins University and so we recommend using the JHU class included in
this package. Subnational data is supported for a subset of countries which
can be found after cleaning using the available_regions()
method,
see the examples for more details. These data sets are minimally cleaned
data files hosted by the team at COVID19 Data Hub so please see their
source repository for further details
(https://github.com/covid19datahub/COVID19/#data-sources)
If using for analysis checking the source for further details is
strongly advised.
If using this class please cite: "Guidotti et al., (2020). COVID-19 Data Hub Journal of Open Source Software, 5(51), 2376, https://doi.org/10.21105/joss.02376"
Super classes
covidregionaldata::DataClass
-> covidregionaldata::CountryDataClass
-> Covid19DataHub
Public fields
origin
name of country to fetch data for
supported_levels
A list of supported levels.
supported_region_names
A list of region names in order of level.
supported_region_codes
A list of region codes in order of level.
level_data_urls
List of named links to raw data. The first, and only entry, is be named main.
source_data_cols
existing columns within the raw data
source_text
Plain text description of the source of the data
source_url
Website address for explanation/introduction of the data
Methods
Inherited methods
Method clean_common()
Covid19 Data Hub specific data cleaning. This takes all the raw data, renames some columns and checks types.
Examples
# nolint start
if (FALSE) {
# set up a data cache
start_using_memoise()
# get all countries data
cv19dh <- Covid19DataHub$new(level = "1", get = TRUE)
cv19dh$return()
# show available regions with data at the second level of interest
cv19dh_level_2 <- Covid19DataHub$new(level = "2")
cv19dh_level_2$download()
cv19dh_level_2$clean()
cv19dh$available_regions()
# get all region data for the uk
cv19dh_level_2$filter("uk")
cv19dh_level_2$process()
cv19dh_level_2$return()
# get all regional data for the UK
uk <- Covid19DataHub$new(regions = "uk", level = "2", get = TRUE)
uk$return()
# get all subregional data for the UK
uk <- Covid19DataHub$new(regions = "uk", level = "3", get = TRUE)
uk$return()
}
# nolint end