sdmx_codelist: Get code list from an SDMX REST API endpoint.

View source: R/sdmx.R

sdmx_codelistR Documentation

Get code list from an SDMX REST API endpoint.

Description

sdmx_codelist constructs an URL for rsdmx::readSDMX and extracts the code IDs. Code lists are downloaded once and cached for the duration of the R session.

estat_codelist gets a code list from the REST API provided at ec.europa.eu/tools/cspa_services_global/sdmxregistry. It is a convenience wrapper that calls sdmx_codelist.

global_codelist gets a code list from the REST API provided at https://registry.sdmx.org/webservice/data.html. It is a convenience wrapper that calls sdmx_codelist.

Usage

sdmx_codelist(
  endpoint,
  agency_id,
  resource_id,
  version = "latest",
  what = c("id", "all")
)

estat_codelist(resource_id, agency_id = "ESTAT", version = "latest")

global_codelist(resource_id, agency_id = "SDMX", version = "latest")

Arguments

endpoint

[character] REST API endpoint of the SDMX registry

agency_id

[character] Agency ID (e.g. "ESTAT")

resource_id

[character] Resource ID (e.g. "CL_ACTIVITY")

version

[character] Version of the code list.

what

[character] Return a character with code id's, or a data frame with all information.

See Also

Other sdmx: sdmx_endpoint(), validator_from_dsd()

Other sdmx: sdmx_endpoint(), validator_from_dsd()

Examples

 

 # here we download the CL_ACTIVITY codelist from the  ESTAT registry.
## Not run: 
 codelist <- sdmx_codelist(
   endpoint = "https://registry.sdmx.org/ws/public/sdmxapi/rest/"
   , agency_id = "ESTAT"
   , resource_id = "CL_ACTIVITY" 

## End(Not run)

## Not run: 
  estat_codelist("CL_ACTIVITY")

## End(Not run)
## Not run: 
  global_codelist("CL_AGE") )
  global_codelist("CL_CONF_STATUS")
  global_codelist("CL_SEX")

## End(Not run)
# An example of using SDMX information, downloaded from the SDMX global
# registry
## Not run: 
 # economic data from the country of Samplonia
 data(samplonomy)
 head(samplonomy)

 rules <- validator(
   , freq %in% global_codelist("CL_FREQ")
   , value >= 0
 )
 cf <- confront(samplonomy, rules) 
 summary(cf)


## End(Not run)

validate documentation built on March 31, 2023, 6:27 p.m.