sp_get_dataset_url {statnipokladna}R Documentation

Get URL of dataset

Description

Useful for workflows where you want to keep track of URLs and intermediate files, rather than having all steps performed by one function.

Usage

sp_get_dataset_url(dataset_id, year, month = 12, check_if_exists = TRUE)

Arguments

dataset_id

Dataset ID. See id column in sp_datasets for a list of available codelists.

year

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

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.)

check_if_exists

Whether to check that the URL works (HTTP 200).

Value

a character vector of length one, containing a URL

See Also

Other Detailed workflow: sp_get_codelist_file(), sp_get_codelist_url(), sp_get_table_file(), sp_load_codelist(), sp_load_table()

Examples

## Not run: 
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

## End(Not run)

[Package statnipokladna version 0.7.3 Index]