restructure: Restructure tables to make them easier to process...

View source: R/restructure.R

restructureR Documentation

Restructure tables to make them easier to process programmatically

Description

Restructure the output of the tabulation functions to make it more structured and easier to process programmatically.

Usage

restructure(tab_output, lvls = c())

Arguments

tab_output

output from a tabulation function. An object of class astra_table or astra_list.

lvls

(optional) only show these levels.

Details

Also see as.data.frame.astra_table() and set_opts(raw = TRUE).

Value

data.frame

See Also

Other print: as.data.frame.astra_table(), print.astra_table(), set_opts()

Examples

set_survey(namcs2019sv, mode = "nchs")

## total() |> restructure()
restructure( total() )

## tab_subset("MAJOR", "AGER") |> restructure(lvls = c("Pre-surgery", "Post-surgery"))
mytables = tab_subset("MAJOR", "AGER")
restructure(mytables, lvls = c("Pre-surgery", "Post-surgery"))

surveytable documentation built on Aug. 20, 2026, 1:08 a.m.