| sc_table_custom | R Documentation |
Define requests against the /table endpoint by providing
URIs to databases, measures and fields.
The URIs can be obtained using sc_schema_db().
See the Custom tables article
for more details.
sc_table_custom(
db,
measures = c(),
dimensions = c(),
language = c("en", "de"),
add_totals = TRUE,
key = NULL,
recodes = NULL,
dry_run = FALSE
)
sc_recode(field, map = NULL, total = FALSE)
db |
The uid of a database. Must be of type |
measures |
A character vector of uids for measures. Each entry must be
of type |
dimensions |
A character vector of dimensions for the cube. Can be
either of type |
language |
The language to be used for labeling. "en" (the default) will use English. "de" uses German. |
add_totals |
Should totals be added for each classification field in
the json request? Ignored if |
key |
( |
recodes |
One or more recodes that were generated via |
dry_run |
If |
field |
An uid of a classification field to be recoded. The provided
uid should also be passed in the |
map |
A list of ids for values (type |
total |
Add totals to the field? If |
for sc_table_custom(): an object of class sc_table
for sc_recode(): a list that is a suitable input for parameter
"recode" in sc_table_custom()
sc_recode(): creates a recode object which can be used
for the recode parameter of sc_table_custom()
it is possible to pass sc_schema objects (usually generated by
sc_schema_db()) instead of ids in sc_table_custom() and sc_recode().
If provided, the schema objects will be converted into ids via $id.
Unfortunately, the API gives fairly vague error messages in case a
custom table request is ill defined. For this reason, sc_table_custom()
applies some simple heuristics and throws warnings if inconsistencies
in the provided parameters are recognized. The following conditions are
currently checked
the parameter db is of type DATABASE
all entries in measures are of type MEASURE, COUNT or
STATFN
all entries in dimensions are of type VALUESET or FIELD
all entries in field are of type VALUESET or FIELD
all entries in map are of type VALUE
all fields in recodes are also present in dimensions
the first two arguments of sc_recode() are consistent, i.e.
if the provided VALUEs belong to the VALUESET/FIELD
sc_table_custom("str:database:detouextregsai")
sc_table_custom(
"str:database:detouextregsai",
dimensions = "str:field:detouextregsai:F-DATA1:C-SDB_TIT-0"
)
sc_table_custom(
db = "str:database:detouextregsai",
measures = c(
"str:statfn:detouextregsai:F-DATA1:F-ANK:SUM",
"str:measure:detouextregsai:F-DATA1:F-UEB"
),
dimensions = c(
"str:field:detouextregsai:F-DATA1:C-SDB_TIT-0",
"str:valueset:detouextregsai:F-DATA1:C-C93-2:C-C93SUM-0"
)
)
schema <- sc_schema_db("detouextregsai")
region <- schema$`Other Classifications`$`Tourism commune [ABO]`$
`Regionale Gliederung (Ebene +1)`
month <- schema$`Mandatory fields`$`Season/Tourism Month`
x <- sc_table_custom(
schema,
schema$Facts$Arrivals,
list(month, region),
recodes = c(
sc_recode(region, total = FALSE, map = list(
region$Achensee,
list(region$Arlberg, region$`Ausseerland-Salzkammergut`)
)),
sc_recode(month, total = FALSE)
)
)
x$tabulate()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.