View source: R/available-data.R
spod_available_data | R Documentation |
Get a table with links to available data files for the specified data version. Optionally check (see arguments) the file size and availability of data files previously 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. By default the data is fetched from Amazon S3 bucket where the data is stored. If that fails, the function falls back to downloading an XML file from the Spanish Ministry of Transport website. You can also control this behaviour with use_s3
argument.
spod_available_data(
ver = 2,
check_local_files = FALSE,
quiet = FALSE,
data_dir = spod_get_data_dir(),
use_s3 = TRUE,
force = FALSE
)
A tibble with links, release dates of files in the data, dates of data coverage, local paths to files, and the download status.
character
. The URL link to the data file.
POSIXct
. The timestamp of when the file was published.
character
. The file extension of the data file (e.g., 'tar', 'gz').
Date
. The year and month of the data coverage, if available.
Date
. The specific date of the data coverage, if available.
factor
. Study category derived from the URL (e.g., 'basic', 'complete', 'routes').
factor
. Data type category derived from the URL (e.g., 'number_of_trips', 'origin-destination', 'overnight_stays', 'data_quality', 'metadata').
factor
. Temporal granularity category derived from the URL (e.g., 'day', 'month').
factor
. Geographic zone classification derived from the URL (e.g., 'districts', 'municipalities', 'large_urban_areas').
character
. The local file path where the data is (or going to be) stored.
logical
. Indicator of whether the data file has been downloaded locally. This is only available if check_local_files
is TRUE
.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.