Skip to contents

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)

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

Value

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

Examples

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