Learn R Programming

surveytable (version 0.10.0)

restructure: 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())

Value

data.frame

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).

See Also

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

Examples

Run this code
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"))

Run the code above in your browser using DataLab