Learn R Programming

sumExtras (version 0.3.0)

use_jama_theme: Apply JAMA Compact Theme to gtsummary Tables

Description

Sets the global gtsummary theme to the JAMA (Journal of the American Medical Association) compact style. This is the recommended theme for use with sumExtras functions, providing professional medical journal formatting with reduced padding and consistent styling. The theme remains active for the entire R session or until changed with another theme.

Usage

use_jama_theme()

Arguments

Value

Invisibly returns the theme list object from gtsummary::theme_gtsummary_compact("jama"). The theme is applied globally via gtsummary::set_gtsummary_theme(), affecting all subsequent gtsummary tables created in the session. A message is printed confirming the theme application.

Details

The JAMA compact theme implements formatting standards used by the Journal of the American Medical Association, making it ideal for:

  • Medical research manuscripts and reports

  • Clinical trial summaries

  • Academic publications requiring AMA style

  • Professional presentations with clean, compact tables

Key formatting features include:

  • Reduced font size (13px) for compact appearance

  • Minimal cell padding (1px) to maximize information density

  • Bold column headers and variable labels

  • Clean borders following JAMA style guidelines

  • Consistent alignment and spacing

The function checks for the gtsummary package and will stop with an informative error if it is not installed. The theme is applied globally and will affect all gtsummary tables created after calling this function, including tbl_summary(), tbl_regression(), tbl_cross(), tbl_strata(), and related functions.

For visual consistency with regular gt tables, use theme_gt_compact() which replicates the same styling for non-gtsummary tables.

See Also

  • theme_gt_compact for applying JAMA-style formatting to regular gt tables

  • extras for standard sumExtras table formatting

  • gtsummary::theme_gtsummary_compact() for other compact theme options

  • gtsummary::set_gtsummary_theme() for setting custom themes

  • gtsummary::reset_gtsummary_theme() for resetting to default theme

Examples

Run this code
# \donttest{
# Apply theme at the start of your analysis
use_jama_theme()

# All subsequent gtsummary tables will use JAMA formatting
gtsummary::trial |>
  gtsummary::tbl_summary(by = trt)

# Works with all gtsummary table types
lm(age ~ trt + grade, data = gtsummary::trial) |>
  gtsummary::tbl_regression()

# Combine with sumExtras styling functions
use_jama_theme()
gtsummary::trial |>
  gtsummary::tbl_summary(by = trt, include = c(age, marker, stage)) |>
  extras() |>
  add_group_styling()

# Reset to default theme if needed
gtsummary::reset_gtsummary_theme()
# }

Run the code above in your browser using DataLab