sumExtras

R-CMD-check CRAN status Lifecycle: stable

sumExtras: “SUMmary table EXTRAS

Overview

{sumExtras} reduces the repetitive boilerplate in {gtsummary} workflows. One function replaces five. Stop copy-pasting add_overall(), add_p(), bold_labels(), and modify_header() on every table. Call extras() once. The package also handles missing value cleanup, automatic variable labeling from data dictionaries, group header styling, and JAMA compact theming.

Installation

CRAN

install.packages("sumExtras")

Development version

# install.packages("pak")
pak::pak("kyleGrealis/sumExtras")

Quick Start

library(sumExtras)
library(gtsummary)

Standard {gtsummary}

theme_gtsummary_compact("jama")

trial |>
  tbl_summary(by = trt) |>
  add_overall() |>
  add_p() |>
  bold_labels() |>
  bold_p() |>
  modify_header(label = "")

With {sumExtras}

use_jama_theme()

trial |>
  tbl_summary(by = trt) |>
  extras()

Table produced by extras()

That single extras() call replaces add_overall(), add_p(), bold_labels(), bold_p(), and modify_header(). It also standardizes missing values via clean_table().

Functions

Options

More Info

Full documentation

FAQ

Why not just use {gtsummary} directly? You can. {sumExtras} wraps the formatting steps you repeat on every table. If you only make one or two tables, you don’t need this package.

What happens if something fails inside extras()? It warns and continues. Your table always renders. See the warn-and-continue design in vignette("sumExtras-intro").

Why didn’t my dictionary labels show up? Your data likely has label attributes that take priority. Set options(sumExtras.prefer_dictionary = TRUE) or see vignette("labeling").

Does extras() work with survey data? Yes. tbl_svysummary tables get the same treatment as tbl_summary.

Contributing

Bug reports, feature requests, and feedback are welcome at https://github.com/kyleGrealis/sumExtras/issues.

License

MIT