Useful for workflows where you want to keep track of URLs and intermediate files, rather than having all steps performed by one function.
sp_get_dataset_url(dataset_id, year, month = 12, check_if_exists = TRUE)
Dataset ID. See id
column in sp_datasets
for a list of available codelists.
year, numeric vector of length <= 1 (can take multiple values), 2015-2019 for some datasets, 2010-2020 for others. (see Details for how to work with data across time periods.)
month, numeric vector of length <= 1 (can take multiple values). Must be between 1 and 12. Defaults to 12. (see Details for how to work with data across time periods.)
Whether to check that the URL works (HTTP 200).
a character vector of length one, containing a URL
Other Detailed workflow:
sp_get_codelist_file()
,
sp_get_codelist_url()
,
sp_get_table_file()
,
sp_load_codelist()
,
sp_load_table()
if (FALSE) { # \dontrun{
sp_get_dataset_url("finm", 2018, 6, FALSE)
sp_get_dataset_url("finm", 2029, 6, FALSE) # works but returns invalid URL
if(FALSE) sp_get_dataset_url("finm_wrong", 2018, 6, TRUE) # fails, invalid dataset ID
if(FALSE) sp_get_dataset_url("finm", 2022, 6, TRUE) # fails, invalid time period
} # }