make_demographic_table: Create a demographics summary table

View source: R/make_demographic_table.R

make_demographic_tableR Documentation

Create a demographics summary table

Description

Create a demographics summary table

Usage

make_demographic_table(data, vars, continuous_vars = NULL)

Arguments

data

A data frame

vars

demographic variables to include in the table

continuous_vars

Optional subset of vars to be treated as continuous

Value

A gtsummary table

Examples

df <- data.frame(
  age = c("25", "30 years", "35", " 40 ", "22.5", "28+", NA, ""),
  sex = c("M", "F", "m", "f", " M ", "F", "m", NA),
  education = c("HS", "BA", "MA", "ma", "Hs", "Ma", "Ba Bed", "Msc bed ")
)

# Generate a demographic summary table (assign to object to avoid printing)
demo_table <- make_demographic_table(df, vars = c("age", "sex", "education"))
demo_table # optionally inspect the table


scaledescr documentation built on April 11, 2026, 5:07 p.m.