jpinfect_get_confirmed {jpinfect}R Documentation

Download the confirmed case datasets from the Japan Institute for Health Security (JIHS)

Description

This function downloads infectious disease data from the Japan Institute for Health Security (JIHS) for specified years and types.

Usage

jpinfect_get_confirmed(
  years = NULL,
  type = "sex",
  overwrite = FALSE,
  dest_dir = NULL
)

Arguments

years

(numeric) A vector of years to download data for. If NULL, the most recent available year will be used. Available years range from 1999 to 2023.

type

(character) The type of data to download. Must be either "sex" or "place".

overwrite

(logical) Whether to overwrite existing files. Defaults to FALSE.

dest_dir

Directory to save files. If NULL, uses tempdir() (files deleted when R session ends). Specify a permanent directory to keep downloaded data.

Details

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.

Value

A character vector of file paths for successfully downloaded files. If a file download fails, the function returns NULL for that year.

Examples


# 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")



[Package jpinfect version 0.1.2 Index]