sp_get_codelist_file: Download a codelist XML file

View source: R/codelists.R

sp_get_codelist_fileR Documentation

Download a codelist XML file

Description

This is normally called inside sp_get_codelist() but can be used separately if finer-grained control of intermediate outputs is needed, e.g. in a {targets} workflow.

Usage

sp_get_codelist_file(
  codelist_id = NULL,
  url = NULL,
  dest_dir = NULL,
  redownload = FALSE
)

Arguments

codelist_id

A codelist ID. See id column in sp_codelists for a list of available codelists.

url

DESCRIPTION. Either this or codelist_id must be set. If both are set, url wins.

dest_dir

character. Directory in which downloaded files will be stored. If left unset, will use the statnipokladna.dest_dir option if the option is set, and tempdir() otherwise. Will be created if it does not exist.

redownload

Redownload even if file has already been downloaded? Defaults to FALSE.

Value

path to XML file; character vector of length one.

See Also

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

Examples

## Not run: 
sp_get_codelist_file("druhuj")
codelist_url <- sp_get_codelist_url("druhuj")
sp_get_codelist_file(url = codelist_url)

## End(Not run)

petrbouchal/statnipokladna documentation built on April 10, 2024, 3:09 p.m.