as.data.frame.astra_table: Coerce an astra table to a data frame

View source: R/as.data.frame.R

as.data.frame.astra_tableR Documentation

Coerce an astra table to a data frame

Description

Coerce an astra table to a data frame. To restructure tables to make them easier to process programmatically, see restructure(). Also see set_opts(raw = TRUE).

If a tabulation function produces multiple tables, that group of tables is a list, with each element of the list being an individual table. To convert one of these tables to a data.frame, use [[. For example, in the following code, we generate 3 tables, and then convert the third table to a data.frame.

set_survey(namcs2019sv)
mytables = tab("MDDO", "SPECCAT", "MSA")
mydf = as.data.frame(mytables[[3]])

Usage

## S3 method for class 'astra_table'
as.data.frame(x, ...)

Arguments

x

a table produced by a tabulation function

...

ignored

Value

A data frame.

See Also

Other print: print.astra_table(), restructure(), set_opts()

Examples

set_survey(namcs2019sv)
as.data.frame( tab("AGER") )

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