sp_get_codelist: Get codelist

View source: R/codelists.R

sp_get_codelistR Documentation

Get codelist

Description

Downloads and processes codelist identified by codelist_id. See sp_codelists for a list of of available codelists with their IDs and names.

Usage

sp_get_codelist(codelist_id, n = NULL, dest_dir = NULL, redownload = FALSE)

Arguments

codelist_id

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

n

Number of rows to return. Default (NULL) means all. Useful for quickly inspecting a codelist.

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.

Details

You can usually tell which codelist you need from the name of the column whose code you are looking to expand, e.g. the codes in column paragraf can be expanded by codelist paragraf.

The processing ensures that the resulting codelist can be correctly joined to the data, automatically using sp_add_codelist() or manually. The entire codelist is downloaded and not filtered for any particular date.

Codelist XML files are stored in a temporary directory as determined by tempdir() and persist per session to avoid redownloads.

Value

a tibble

See Also

Other Core workflow: add_codelist(), get_codelist(), sp_add_codelist(), sp_get_dataset(), sp_get_table()

Examples

## Not run: 
sp_get_codelist("paragraf")

## End(Not run)

statnipokladna documentation built on Dec. 28, 2022, 2:36 a.m.