Learn R Programming

PxWebApiData (version 1.9.0)

meta_data: PxWebApi v2 metadata for a table

Description

Retrieves metadata for a table using the PxWebApi v2 endpoint and returns it as an R object via jsonlite::read_json().

Usage

meta_data(url_or_tableid, url_type = "ssb")

Value

A list containing table metadata read by jsonlite::read_json() after internal URL adjustments via ensure_json_stat2(). The data URL is stored in the comment attribute of the returned object.

Arguments

url_or_tableid

Either a numeric table id or a PxWebApi v2 URL to data. When a data URL is supplied, it is internally converted to a metadata URL.

url_type

Currently two possibilities: "ssb" (Norwegian) or "ssb_en" (English).

Examples

Run this code
metadata1 <- meta_data(8991, url_type = "ssb_en")
metadata2 <- meta_data(
  "https://statistikdatabasen.scb.se/api/v2/tables/TAB1525/data?lang=en"
)

print(metadata1[1:4])
print(metadata2[1:4])

Run the code above in your browser using DataLab