Learn R Programming

gtsummary (version 0.1.0)

assign_summary_type: Assigns summary type (e.g. continuous, categorical, or dichotomous).

Description

For variables where the summary type was not specified in the function call of fmt_table1, assign_summary_type assigns a type based on class and number of unique levels.

Usage

assign_summary_type(data, variable, class, summary_type)

Arguments

data

Data frame.

variable

Vector of column name.

class

Vector of classes (e.g. numeric, character, etc.) corresponding one-to-one with the names in variable.

summary_type

list that includes specified summary types, e.g. summary_type = list(age = "continuous")

Value

Vector summary types c("continuous", "categorical", "dichotomous").

Examples

Run this code
# NOT RUN {
gtsummary:::assign_summary_type(
  data = mtcars,
  variable =  names(mtcars),
  class = apply(mtcars, 2, class),
  summary_type = NULL
)
# }

Run the code above in your browser using DataLab