sc_table | R Documentation |
Send requests against the /table
endpoint of the STATcube REST API. The
requests can use three formats with corresponding functions
sc_table()
uses a json file downloaded via the STATcube GUI
sc_table_custom()
uses the ids of a database, measures and fields
sc_table_saved()
uses a table uri of a saved table.
Those three functions all return an object of class "sc_table"
.
sc_table(json, language = NULL, add_totals = TRUE, key = NULL, json_file = NA)
sc_examples_list()
sc_example(filename)
sc_table_saved_list(key = NULL, server = "ext")
sc_table_saved(table_uri, language = NULL, key = NULL, server = "ext")
json |
Path to a json file, which was downloaded via the STATcube
GUI ("Open Data API Request"). Alternatively, a json string which
passes |
language |
The language to be used for labeling. |
add_totals |
Should totals be added for each classification field in the json request? |
key |
( |
json_file |
Deprecated. Use |
filename |
The name of an example json file. |
server |
A STATcube API server. Defaults to the external Server via
|
table_uri |
Identifier of a saved table as returned by
|
An object of class sc_table
which contains the return
value of the httr::POST()
request in obj$response
. The object also
provides member functions to parse this response object. See
sc_table_class for the class documentation.
my_table <- sc_table(json = sc_example("population_timeseries.json"))
# print
my_table
# get matadata for the table
my_table$meta
# get a data.frame
as.data.frame(my_table)
# get metadata for field 2
my_table$field(2)
# get the ids and labels of all saved tables
(saved_tables <- sc_table_saved_list())
table_uri <- saved_tables$id[1]
# get a table based on one of these ids
my_response <- sc_table_saved(table_uri)
as.data.frame(my_response)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.