MyNixOS website logo
Description

Extra Functions for 'gtsummary' Table Styling.

Provides additional convenience functions for 'gtsummary' (Sjoberg et al. (2021) <doi:10.32614/RJ-2021-053>) & 'gt' tables, including automatic variable labeling from dictionaries, standardized missing value display, and consistent formatting helpers for streamlined table styling workflows.

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

  • extras() -- overall column, p-values (bolded), bold labels, clean styling
  • clean_table() -- standardize missing value display
  • add_auto_labels() -- automatic labeling from dictionaries or data attributes
  • use_jama_theme() / theme_gt_compact() -- JAMA compact themes
  • add_group_styling() -- bold/italic formatting for group headers
  • add_group_colors() -- background colors for group headers (converts to {gt})
  • get_group_rows() -- extract group header row indices

Options

  • options(sumExtras.auto_labels = TRUE) -- add labels through the project without needing add_auto_labels() for each table
  • options(sumExtras.prefer_dictionary = TRUE) -- change the labeling priority

More Info

Full documentation

  • vignette("sumExtras-intro") -- getting started
  • vignette("labeling") -- dictionary-based labeling
  • vignette("themes") -- JAMA themes for {gtsummary} and {gt}
  • vignette("styling") -- group headers and advanced formatting
  • vignette("options") -- .Rprofile options for auto-labeling
  • Bug reports & feature requests

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.

Metadata

Version

1.0.0

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows