Skip to contents

Renders a clerk_tbl as a gt table with clerkR styling applied via clerk_theme(). Domain groupings become row-group labels; log-transformed variables receive an automatic footnote; FDR-corrected tables receive an automatic source note. Typically called indirectly via clerk_render().

Domains may be nested (a named list of named lists) to express sub-sections within a domain, e.g. repeated timepoints within a "Mental health" domain. gt itself has no native support for two-level row-group headers, so a nested domain renders as a single compound row group: the domain and subdomain names joined with an em dash, e.g. "Mental health" + "Baseline" becomes one row group labelled Mental health - Baseline (rendered with a true em dash, not a hyphen). For a table with true expandable nested groups, use output = "html" instead (see render_reactable()).

Usage

render_gt(
  x,
  title = NULL,
  subtitle = NULL,
  footnote = NULL,
  footnotes = NULL,
  fdr_footnote = TRUE,
  ...
)

Arguments

x

A clerk_tbl object.

title

Optional table title.

subtitle

Optional table subtitle.

footnote

Optional character vector of blanket footnotes, one source note per element.

footnotes

Optional list of targeted footnotes. Each element is a list with text and either rows (variable names) or cols (column names).

fdr_footnote

Logical. Add an automatic FDR source note when a p_fdr column is present (default TRUE).

...

Reserved for future use.

Value

A gt_tbl object.

Examples

tbl_descriptive(clerk_example, group = sex) |>
  render_gt(title = "Table 1")
Table 1
n Overall Female Male Statistic p
age 300 46.76 ± 14.15 46.42 ± 13.63 47.35 ± 15.09 t = -0.53 = 0.599
hdl 300 46.81 ± 10.11 48.32 ± 9.78 44.08 ± 10.18 t = 3.50 < 0.001
glucose 300 91.68 ± 24.65 92.61 ± 24.49 90.01 ± 24.96 t = 0.87 = 0.386
bmi 300 26.15 ± 4.91 26.43 ± 4.84 25.64 ± 5.01 t = 1.32 = 0.190
waist 300 92.07 ± 11.56 92.14 ± 11.32 91.93 ± 12.03 t = 0.15 = 0.879
systolic_bp 300 123.25 ± 17.77 120.36 ± 17.86 128.48 ± 16.45 t = -3.97 < 0.001
tmt_time 300 129.24 ± 64.98 132.81 ± 66.77 122.81 ± 61.40 t = 1.31 = 0.192
verbal_fluency 300 14.98 ± 4.63 15.08 ± 4.44 14.79 ± 4.97 t = 0.52 = 0.606
bdi 300 13.64 ± 9.26 15.07 ± 8.97 11.05 ± 9.26 t = 3.65 < 0.001
panas_neg 300 20.98 ± 7.48 22.50 ± 7.27 18.25 ± 7.09 t = 4.92 < 0.001
life_satisfaction 300 18.02 ± 4.23 17.40 ± 4.25 19.14 ± 3.99 t = -3.54 < 0.001