Skip to contents

R6 Class for all responses of the /table endpoint of the 'STATcube' REST API.

Super class

STATcubeR::sc_data -> sc_table

Active bindings

response

the httr response

raw

the raw response content

annotation_legend

list of all annotations occurring in the data as a data.frame with two columns for the annotation keys and annotation labels.

rate_limit

how much requests were left after the POST request for this table was sent? Uses the same format as sc_rate_limit_table().

json

an object of class sc_json based the json file used in the request

Methods

Inherited methods


Method new()

Usually, objects of class sc_table are generated with one of the factory methods sc_table(), sc_table_saved() or sc_table_custom(). If this constructor is invoked directly, either omit the parameters json and file or make sure that they match with response.

Usage

sc_table_class$new(response, json = NULL, file = NULL, add_totals = FALSE)

Arguments

response

a response from httr::POST() against the /table endpoint.

json

the json file used in the request as a string.

file

the file path to the json file

add_totals

was the json request modified by adding totals via the add_totals parameter in one of the factory functions (sc_table(), sc_table_custom()). Necessary, in order to also request totals via the $add_language() method.


Method update()

Update the data by re-sending the json to the API. This is still experimental and could break the object in case new levels were added to one of the fields. For example, if a new entry is added to a timeseries

Usage

sc_table_class$update()


Method tabulate()

An extension of sc_tabulate() with additional parameters.

Usage

sc_table_class$tabulate(
  ...,
  round = FALSE,
  annotations = FALSE,
  recode_zeros = FALSE
)

Arguments

...

Parameters which are passed down to sc_tabulate()

round

apply rounding to each measure according to the precision provided by the API.

annotations

Include separate annotation columns in the returned table. This parameter is currently broken and needs to be re-implemented

recode_zeros

interpret zero values as missings?


Method browse()

open the dataset in a browser

Usage

sc_table_class$browse()


Method add_language()

add a second language to the dataset

Usage

sc_table_class$add_language(language = NULL, key = NULL)

Arguments

language

a language to add. "en" or "de".

key

an API key