View source: R/shared-methods.R
| initialise_dataclass | R Documentation |
This function initialises classes based on the DataClass()
which allows documented downloading, cleaning, and processing. See the
examples for some potential use cases and the DataClass() documentation
for more details.
initialise_dataclass(
class = character(),
level = "1",
totals = FALSE,
localise = TRUE,
regions,
verbose = TRUE,
steps = FALSE,
get = FALSE,
type = c("national", "regional"),
...
)
class |
A character string specifying the |
level |
A character string indicating the target administrative level
of the data with the default being "1". Currently supported options are
level 1 ("1) and level 2 ("2"). Use |
totals |
Logical, defaults to FALSE. If TRUE, returns totalled data per region up to today's date. If FALSE, returns the full dataset stratified by date and region. |
localise |
Logical, defaults to TRUE. Should region names be localised. |
regions |
A character vector of target regions to be assigned to the
|
verbose |
Logical, defaults to |
steps |
Logical, defaults to FALSE. Should all processing and cleaning steps be kept and output in a list. |
get |
Logical, defaults to FALSE. Should the class |
type |
A character vector indicating the types of data to
return. Current options include "national" (which are datasets at the
national level which inherit from |
... |
Additional arguments to pass to class specific functionality. |
An initialised version of the target class if available,
e.g. Italy()
Data interface functions
CountryDataClass,
DataClass,
get_available_datasets(),
get_national_data(),
get_regional_data()
## Not run:
# set up a cache to store data to avoid downloading repeatedly
start_using_memoise()
# check currently available datasets
get_available_datasets()
# initialise a data set in the United Kingdom
# at the UTLA level
utla <- UK$new(level = "2")
# download UTLA data
utla$download()
# clean UTLA data
utla$clean()
# inspect available level 1 regions
utla$available_regions(level = "1")
# filter data to the East of England
utla$filter("East of England")
# process UTLA data
utla$process()
# return processed and filtered data
utla$return()
# inspect all data steps
utla$data
# initialise Italian data, download, clean and process it
italy <- initialise_dataclass("Italy", get = TRUE)
italy$return()
# initialise ECDC data, fully process it, and return totals
ecdc <- initialise_dataclass("ecdc", get = TRUE, totals = TRUE)
ecdc$return()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.