use_jama_theme()use_jama_theme() sets the {gtsummary} theme
to JAMA compact styling for the rest of your session. It reduces
padding, tightens font sizes, and produces tables suited for publication
or reports.
| Overall N = 2001 |
Drug A N = 981 |
Drug B N = 1021 |
p-value2 | |
|---|---|---|---|---|
| Age | 47 (38, 57) | 46 (37, 60) | 48 (39, 56) | 0.718 |
| Unknown | 11 | 7 | 4 | |
| Marker Level (ng/mL) | 0.64 (0.22, 1.41) | 0.84 (0.23, 1.60) | 0.52 (0.18, 1.21) | 0.085 |
| Unknown | 10 | 6 | 4 | |
| T Stage | 0.866 | |||
| T1 | 53 (27%) | 28 (29%) | 25 (25%) | |
| T2 | 54 (27%) | 25 (26%) | 29 (28%) | |
| T3 | 43 (22%) | 22 (22%) | 21 (21%) | |
| T4 | 50 (25%) | 23 (23%) | 27 (26%) | |
| Grade | 0.871 | |||
| I | 68 (34%) | 35 (36%) | 33 (32%) | |
| II | 68 (34%) | 32 (33%) | 36 (35%) | |
| III | 64 (32%) | 31 (32%) | 33 (32%) | |
| Tumor Response | 61 (32%) | 28 (29%) | 33 (34%) | 0.530 |
| Unknown | 7 | 3 | 4 | |
| Patient Died | 112 (56%) | 52 (53%) | 60 (59%) | 0.412 |
| Months to Death/Censor | 22.4 (15.9, 24.0) | 23.5 (17.4, 24.0) | 21.2 (14.5, 24.0) | 0.145 |
| 1 Median (Q1, Q3); n (%) | ||||
| 2 Wilcoxon rank sum test; Pearson’s Chi-squared test | ||||
This is equivalent to calling
gtsummary::set_gtsummary_theme(gtsummary::theme_gtsummary_compact("jama"))
but shorter to type.
To reset back to the default {gtsummary} theme:
theme_gt_compact()When you mix {gtsummary} tables with plain
{gt} tables in the same document, the styling mismatch is
noticeable. theme_gt_compact() applies the same JAMA
compact look to {gt} tables.
| Chemotherapy Treatment | Age | Grade |
|---|---|---|
| Drug A | 23 | II |
| Drug B | 9 | I |
| Drug A | 31 | II |
| Drug A | NA | III |
| Drug A | 51 | III |
| Drug B | 39 | I |
| Drug A | 37 | II |
| Drug A | 32 | I |
| Drug A | 31 | II |
| Drug B | 34 | I |
| Chemotherapy Treatment | Age | Grade |
|---|---|---|
| Drug A | 23 | II |
| Drug B | 9 | I |
| Drug A | 31 | II |
| Drug A | NA | III |
| Drug A | 51 | III |
| Drug B | 39 | I |
| Drug A | 37 | II |
| Drug A | 32 | I |
| Drug A | 31 | II |
| Drug B | 34 | I |
You can layer additional {gt} styling on top:
trial |>
dplyr::select(trt, age, grade, marker) |>
head(8) |>
gt::gt() |>
theme_gt_compact() |>
gt::tab_header(
title = "Trial Patient Sample",
subtitle = "First 8 patients"
)| Trial Patient Sample | |||
| First 8 patients | |||
| Chemotherapy Treatment | Age | Grade | Marker Level (ng/mL) |
|---|---|---|---|
| Drug A | 23 | II | 0.160 |
| Drug B | 9 | I | 1.107 |
| Drug A | 31 | II | 0.277 |
| Drug A | NA | III | 2.067 |
| Drug A | 51 | III | 2.767 |
| Drug B | 39 | I | 0.613 |
| Drug A | 37 | II | 0.354 |
| Drug A | 32 | I | 1.739 |
vignette("sumExtras-intro") – getting started with
extras()vignette("labeling") – dictionary-based labelingvignette("styling") – group headers and advanced
formattingvignette("options") – .Rprofile options for automatic
labeling