| sc_tabulate | R Documentation | 
sc_tabulate() extracts the data in the table and turns it into a tidy
data.frame. It applies labeling of the data and transforms time variables
into a Date format if they satisfy certain 'STATcube' standards.
sc_tabulate(table, ...) is just an alias for table$tabulate(...) and
was added so this rather complicated method can have a separate documentation
page. It is recommended to use the table$tabulate() syntax
the ... argument decides which measures and/or fields should be included
in the output. If no measures are given, all measures are included. The same
is true for fields.
sc_tabulate(
  table,
  ...,
  .list = NULL,
  raw = FALSE,
  parse_time = TRUE,
  recode_zeros = inherits(table, "sc_table"),
  language = NULL,
  sort = FALSE
)
| table | An object of class  | 
| ... | Names of measures and/or fields | 
| .list | allows to define the arguments for  | 
| raw | If FALSE (the default), apply labeling to the dataset. Otherwise, return codes. | 
| parse_time | Should time variables be converted into a  | 
| recode_zeros | turn zero values into  | 
| language | The language to be used for labeling. By default, the
dataset language ( | 
| sort | If  | 
Aggregation is done as follows
 First, all columns that provide a total code via table$total_codes()
will be used to filter for column == total_code or column != total_code
 Then, the remaining data is aggregated using rowsum()
The ellipsis (...) supports partial matching of codes and labels.
See Examples
For objects of class sc_table two additional operations are performed.
 zeros are recoded to NAs
 rounding is done according to the precision of each measure. Rounding
happens after the recoding to NA values
a data.frame
sc_table_class
############################ OGD Data #######################################
table <- od_table("OGD_veste309_Veste309_1")
# no arguments -> same output as `table$data`
table$tabulate()
# provide some fields -> aggregate to keep only these fields
table$tabulate("Sex", "Citizenship")
# provide some measures -> drop all other measures from the output
table$tabulate("Arithmetic mean")
# mixture of measures and fields  -> keep exactly those columns
table$tabulate("Sex", "Arithmetic mean")
## define total codes
table$total_codes(
  `C-A11-0` = "A11-1",
  `C-STAATS-0` = "STAATS-9",
  `C-VEBDL-0` = "VEBDL-10",
  `C-BESCHV-0` = "BESCHV-1"
)
## alternatively, use partial matching to define totals
table$total_codes(
  Sex = "Sum total",
  Citizenship = "Total",
  Region = "Total",
  `Form of employment` = "Total"
)
# filter for totals in `Region (NUTS2)` and `Form of employment`. Drop totals
# in `Sex` and `Citizenship`.
table$tabulate("Sex", "Citizenship")
## switch language
table$language <- "de"
## `...` matches for codes and labels
table$tabulate("C-A11-0", "Staats", "2. Quartil (Median)")
## Keep totals in the output by removing total codes
table$tabulate("C-A11-0")      # -> 2 rows: "male" "female"
table$total_codes(`C-A11-0` = NA)
table$tabulate("C-A11-0")      # -> 3 rows: "total", "male", "female"
## table$tabulate(...) is an alias for sc_tabulate(table, ...)
sc_tabulate(table, "C-A11-0")
######################## 'STATcube' REST API ################################
table_tourism <- sc_table(sc_example("accomodation.json"), "de")
table_tourism$tabulate()
table_tourism$tabulate("Saison/Tourismusmonat")
table_tourism$tabulate("Saison/Tourismusmonat", "Ankünfte")
table_tourism$tabulate("Ankünfte")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.