pxweb (version 0.9.1)

pxweb_api-class: A Reference Class to represent an pxweb_api

Description

A Reference Class to represent an pxweb_api

Arguments

Fields

api

The name of the api (api domain)

description

Short description of the pxweb api.

url

An url template for the pxweb api.

versions

A character vector with versions of the api.

languages

A character vector with languages of the api.

calls_per_period

The number of allowed calls per period.

period_in_seconds

The length of the period with allowed calls.

max_values_to_download

Maximum number of values to download with each call.

Methods

base_url(version = NULL, language = NULL)

Create a base url from the api for version and language. The first element of versions and languages is used as standard.

check_alt(version = NULL, language = NULL)

Check if the version/language alternative exist in the object.

check_input()

Check the consistency of the fields.

get_api(api_name)

Get the api configuration from inst/extdata/api.json for the api_name.

initialize(get_api = NULL, ...)

Create a new pxweb_api object.

pxweb_api_to_list()

Create a list of the current pxweb_api object

test_api(test_type = "fast", seed = as.integer(Sys.time()))

Test to connect to the api and download for each api version/language.

:param test_type: c("fast", "sample", "full").

"fast" check that one random datapoint can be downloaded from each api

"sample" check that one random datapoint can be downloaded from each node

"full" check that all datapoints can be downloaded

:param seed: seed to use for random choice of data points.

write_to_catalogue()

Save/overwrite the current api as a locally stored api.

Examples

Run this code
# NOT RUN {
 scb_pxweb_api <- pxweb_api$new(get_api = "api.scb.se")
 scb_pxweb_api
# }
# NOT RUN {
 
# }

Run the code above in your browser using DataLab