Skip to contents

Dispatches to the correct renderer based on the output slot set at construction time (tbl_descriptive(..., output = "gt"|"html"|"latex")). All render arguments (title, subtitle, footnote, footnotes) can be supplied here and are forwarded to the underlying renderer.

Usage

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

Arguments

x

A clerk_tbl object.

title

Optional character string for the table title.

subtitle

Optional character string for the table subtitle.

footnote

Optional character vector of blanket footnote text, rendered as one source note per element, below the table. Appended after any automatic footnotes (log-transform, FDR).

footnotes

Optional list of targeted footnotes, each attached to specific rows or columns rather than the whole table. Each element is a list with a text string and either a rows (variable names, matched against the table stub) or cols (column names) character vector. See vignette("formatting-options") for examples.

fdr_footnote

Logical. Automatically add a source note explaining the FDR correction when a p_fdr column is present (default TRUE).

...

Passed to the underlying render_gt(), render_reactable(), or render_latex().

Value

A gt_tbl, htmltools::tagList, or knit_asis object depending on the output slot of x.

Examples

tbl_descriptive(clerk_example, group = sex, output = "gt", fdr = TRUE) |>
  clerk_render(title = "Table 1")
Table 1
n Overall Female Male Statistic p p (FDR)
age 300 46.76 ± 14.15 46.42 ± 13.63 47.35 ± 15.09 t = -0.53 = 0.599 ns
hdl 300 46.81 ± 10.11 48.32 ± 9.78 44.08 ± 10.18 t = 3.50 < 0.001 = 0.001
glucose 300 91.68 ± 24.65 92.61 ± 24.49 90.01 ± 24.96 t = 0.87 = 0.386 ns
bmi 300 26.15 ± 4.91 26.43 ± 4.84 25.64 ± 5.01 t = 1.32 = 0.190 ns
waist 300 92.07 ± 11.56 92.14 ± 11.32 91.93 ± 12.03 t = 0.15 = 0.879 ns
systolic_bp 300 123.25 ± 17.77 120.36 ± 17.86 128.48 ± 16.45 t = -3.97 < 0.001 < 0.001
tmt_time 300 129.24 ± 64.98 132.81 ± 66.77 122.81 ± 61.40 t = 1.31 = 0.192 ns
verbal_fluency 300 14.98 ± 4.63 15.08 ± 4.44 14.79 ± 4.97 t = 0.52 = 0.606 ns
bdi 300 13.64 ± 9.26 15.07 ± 8.97 11.05 ± 9.26 t = 3.65 < 0.001 = 0.001
panas_neg 300 20.98 ± 7.48 22.50 ± 7.27 18.25 ± 7.09 t = 4.92 < 0.001 < 0.001
life_satisfaction 300 18.02 ± 4.23 17.40 ± 4.25 19.14 ± 3.99 t = -3.54 < 0.001 = 0.001
p (FDR): Benjamini-Hochberg false discovery rate correction applied.
tbl_descriptive(clerk_example, group = sex, output = "html") |> clerk_render(title = "Sample characteristics") #> <p style="font-size:14px; font-weight:600; color:#293681;margin:0 0 2px 0; font-family:&#39;DM Sans&#39;,sans-serif;">Sample characteristics</p> #> <div class="reactable html-widget html-fill-item" id="htmlwidget-ac96cb3ee4656e2e9ec3" style="width:auto;height:auto;"></div> #> <script type="application/json" data-for="htmlwidget-ac96cb3ee4656e2e9ec3">{"x":{"tag":{"name":"Reactable","attribs":{"data":{"variable":["age","hdl","glucose","bmi","waist","systolic_bp","tmt_time","verbal_fluency","bdi","panas_neg","life_satisfaction"],"n":[300,300,300,300,300,300,300,300,300,300,300],"overall":["46.76 ± 14.15","46.81 ± 10.11","91.68 ± 24.65","26.15 ± 4.91","92.07 ± 11.56","123.25 ± 17.77","129.24 ± 64.98","14.98 ± 4.63","13.64 ± 9.26","20.98 ± 7.48","18.02 ± 4.23"],"Female":["46.42 ± 13.63","48.32 ± 9.78","92.61 ± 24.49","26.43 ± 4.84","92.14 ± 11.32","120.36 ± 17.86","132.81 ± 66.77","15.08 ± 4.44","15.07 ± 8.97","22.50 ± 7.27","17.40 ± 4.25"],"Male":["47.35 ± 15.09","44.08 ± 10.18","90.01 ± 24.96","25.64 ± 5.01","91.93 ± 12.03","128.48 ± 16.45","122.81 ± 61.40","14.79 ± 4.97","11.05 ± 9.26","18.25 ± 7.09","19.14 ± 3.99"],"statistic":["t = -0.53","t = 3.50","t = 0.87","t = 1.32","t = 0.15","t = -3.97","t = 1.31","t = 0.52","t = 3.65","t = 4.92","t = -3.54"],"p":["= 0.599","< 0.001","= 0.386","= 0.190","= 0.879","< 0.001","= 0.192","= 0.606","< 0.001","< 0.001","< 0.001"],"domain":["","","","","","","","","","",""],"subdomain":["","","","","","","","","","",""],"domain_group":["","","","","","","","","","",""]},"columns":[{"id":"variable","name":"variable","type":"character"},{"id":"n","name":"n","type":"numeric"},{"id":"overall","name":"overall","type":"character"},{"id":"Female","name":"Female","type":"character"},{"id":"Male","name":"Male","type":"character"},{"id":"statistic","name":"statistic","type":"character"},{"id":"p","name":"p","type":"character"},{"id":"domain","name":"domain","type":"character"},{"id":"subdomain","name":"subdomain","type":"character"},{"id":"domain_group","name":"domain_group","type":"character"}],"searchable":true,"highlight":true,"striped":true,"compact":true,"dataKey":"e1d941218297676ff50649c597894b12"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}</script>