Skip to contents

Produces a concise descriptive summary — mean ± SD for continuous variables and n (%) for categorical variables — with no group comparisons or statistical tests. Formatting defaults inherited from clerk_options().

Usage

tbl_simple(
  data,
  vars = NULL,
  domains = list(),
  log_vars = character(0),
  digits = NULL,
  domain_other = NULL,
  output = c("gt", "html", "latex")
)

Arguments

data

A data frame.

vars

<tidy-select> Variables to include. Defaults to all columns.

domains

A named list mapping variable names to domain/section labels. An entry may itself be a named list to create a nested sub-section within a domain (e.g. repeated timepoints) – see vignette("formatting-options").

log_vars

Character vector of log-transformed variable names.

digits

Integer. Decimal places for continuous variables.

domain_other

Character string. Label for variables not assigned to any domain. Default "" (blank). Inherits from clerk_options()$domain_other.

output

Character string. One of "gt" (default), "html", or "latex".

Value

A clerk_tbl object with type "simple".

Examples

tbl_simple(
  clerk_example,
  domains  = list(
    "Metabolic"    = c("hdl", "glucose", "bmi"),
    "Mental health"= c("bdi", "panas_neg")
  ),
  log_vars = "tmt_time",
  output   = "gt"
) |> clerk_render(title = "Descriptive statistics")
Descriptive statistics
n Summary
Metabolic
hdl 300 46.81 ± 10.11
glucose 300 91.68 ± 24.65
bmi 300 26.15 ± 4.91
Mental health
bdi 300 13.64 ± 9.26
panas_neg 300 20.98 ± 7.48
sex 300 Female: 193 (64.3%); Male: 107 (35.7%)
age 300 46.76 ± 14.15
waist 300 92.07 ± 11.56
systolic_bp 300 123.25 ± 17.77
tmt_time1 300 129.24 ± 64.98
verbal_fluency 300 14.98 ± 4.63
life_satisfaction 300 18.02 ± 4.23
1 Log-transformed variables shown on raw scale.