Get a table with links to available data files for the specified data version. Optionally check (see arguments) if certain files have already been downloaded into the cache directory specified with SPANISH_OD_DATA_DIR environment variable (set by spod_set_data_dir) or a custom path specified with data_dir
argument.
Usage
spod_available_data(
ver = 2,
check_local_files = FALSE,
quiet = FALSE,
data_dir = spod_get_data_dir()
)
Arguments
- ver
Integer. Can be 1 or 2. The version of the data to use. v1 spans 2020-2021, v2 covers 2022 and onwards.
- check_local_files
Whether to check if the local files exist. Defaults to
FALSE
.- quiet
A
logical
value indicating whether to suppress messages. Default isFALSE
.- data_dir
The directory where the data is stored. Defaults to the value returned by
spod_get_data_dir()
.
Value
A tibble with links, release dates of files in the data, dates of data coverage, local paths to files, and the download status.
- target_url
character
. The URL link to the data file.- pub_ts
POSIXct
. The timestamp of when the file was published.- file_extension
character
. The file extension of the data file (e.g., 'tar', 'gz').- data_ym
Date
. The year and month of the data coverage, if available.- data_ymd
Date
. The specific date of the data coverage, if available.- local_path
character
. The local file path where the data is stored.- downloaded
logical
. Indicator of whether the data file has been downloaded locally. This is only available ifcheck_local_files
isTRUE
.
Examples
if (FALSE) { # interactive()
# \donttest{
# Set data dir for file downloads
spod_set_data_dir(tempdir())
# Get available data list for v1 (2020-2021) data
spod_available_data(ver = 1)
# Get available data list for v2 (2022 onwards) data
spod_available_data(ver = 2)
# Get available data list for v2 (2022 onwards) data
# while also checking for local files that are already downloaded
spod_available_data(ver = 2, check_local_files = TRUE)
# }
}