Learn R Programming

pxweb (version 0.19.2)

pxweb_codelists: List PXWEB API v2 codelists in metadata.

Description

Extracts aggregation and value set codelists from a PXWEB API v2 metadata object. Use the returned id values with pxweb_aggregation or pxweb_valueset.

Usage

pxweb_codelists(x, variable = NULL, type = NULL)

Value

A data.frame with columns variable_code, variable_text, id, label, type, and href.

Arguments

x

a pxweb_metadata object created from PXWEB API v2 metadata, or a raw PXWEB API v2 metadata list.

variable

optional variable code or label to filter on.

type

optional codelist type to filter on, for example "Aggregation" or "Valueset".

Examples

Run this code
if (FALSE) {
meta <- pxweb_get("https://statistikdatabasen.scb.se/api/v2/tables/TAB5974/metadata?lang=sv")
pxweb_codelists(meta, variable = "Alder")
}

Run the code above in your browser using DataLab