Skip to contents

Flattens a procr_varformat object into a single data.frame. Each internal data frame is combined, a name column is added to indicate the original list element, and a pos column is added to indicate the row or column header position of each name-label combination in the implied procr_table.

Usage

# S3 method for class 'procr_varformat'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

A procr_varformat object.

row.names

NULL or a character vector giving the row names for the data frame. Missing values are not allowed.

optional

Not used, included for compatibility with as.data.frame()

...

Not used, included for compatibility with as.data.frame()

Value

A data.frame containing all rows from the procr_varformat object, with an additional name column for the original list names, and a pos column with the header positions as numerical vectors. The formula element of the input is added as an attribute.

See also

generate_header() to generate an expanded data.frame of row or column labels.

Examples

myfmt <- new_format(var = Sepal.Length,
                    . < 5.8 ~ "low",
                    . >= 5.8 ~ "high")
as.data.frame(myfmt)
#>           name label level parent  subset_info                code pos
#> 1 Sepal.Length   low     1   <NA> NA, c(ex....  Sepal.Length < 5.8   1
#> 2 Sepal.Length  high     1   <NA> NA, c(ex.... Sepal.Length >= 5.8   2