View source: R/jpinfect_get_confirmed.R
jpinfect_get_confirmed | R Documentation |
This function downloads infectious disease data from the Japan Institute for Health Security (JIHS) for specified years and types.
jpinfect_get_confirmed(
years = NULL,
type = "sex",
overwrite = FALSE,
dest_dir = NULL
)
years |
(numeric) A vector of years to download data for. If |
type |
(character) The type of data to download. Must be either |
overwrite |
(logical) Whether to overwrite existing files. Defaults to |
dest_dir |
Directory to save files. If NULL, uses tempdir() (files deleted when R session ends). Specify a permanent directory to keep downloaded data. |
This function validates the input parameters, including the range of years and
the type of data. It creates the destination directory if it does not already exist.
For each year, the function attempts to download the corresponding file from JIHS.
If a file already exists and overwrite = FALSE
, the download is skipped.
A character vector of file paths for successfully downloaded files. If
a file download fails, the function returns NULL
for that year.
# Download data for 2020 and 2021
jpinfect_get_confirmed(years = c(2020, 2021), type = "sex")
# Download data for all available years
jpinfect_get_confirmed(type = "place")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.