Learn R Programming

table.glue (version 0.0.5)

as_inline: Convert table data to inline list

Description

Convert table data to inline list

Usage

as_inline(data, tbl_variables, tbl_values)

Value

a list of tbl_values values for each permutation of tbl_variables

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.

Examples

Run this code

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

Run the code above in your browser using DataLab