as_inline: Convert table data to inline list

View source: R/as_inline.R

as_inlineR Documentation

Convert table data to inline list

Description

Convert table data to inline list

Usage

as_inline(data, tbl_variables, tbl_values)

Arguments

data

a data frame.

tbl_variables

column names that will be used to form groups in the table

tbl_values

column names that contains table values.

Value

a list of tbl_values values for each permutation of tbl_variables

Note

variables in tbl_variables that have missing values will be have their missing values converted into an explicit category named variable_missing, where 'variable' is the name of the variable.

Examples


example_data <- data.frame(
  sex = c("female", "male"),
  height = c("158 (154 - 161)", "178 (175 - 188)")
)

as_inline(example_data, tbl_variables = 'sex', tbl_values = 'height')

car_data <- mtcars
car_data$car_name <- rownames(mtcars)
as_inline(car_data, tbl_variables = 'car_name', tbl_values = 'mpg')


table.glue documentation built on Feb. 16, 2023, 9:29 p.m.