summarytab: Table 1-style descriptive summary

View source: R/explore.R

summarytabR Documentation

Table 1-style descriptive summary

Description

Build a publication-style summary table of one or more variables, optionally stratified by a grouping column, in the manner of a clinical "Table 1".

Usage

summarytab(
  data,
  vars = NULL,
  by = NULL,
  overall = TRUE,
  p_value = FALSE,
  digits = 1
)

Arguments

data

A data.frame.

vars

Character vector of variables to summarize. Defaults to every column other than by.

by

Optional single column name used to stratify the summary.

overall

Include an "Overall" column alongside the by-group columns.

p_value

Include a column of between-group p-values. Requires by.

digits

Number of decimal places used when formatting numbers.

Value

A basetable with one row per variable (or variable level), and one column per stratum plus Overall/p_value as requested.


basetable documentation built on Sept. 18, 2026, 9:13 a.m.