Tools for Creating Publication-Ready Regression Tables

Simplifies regression modelling in R by integrating modelling, diagnostics, visualisation, and summary tools into a cohesive, user-friendly interface. Designed to be accessible for researchers, particularly those in Low- and Middle-Income Countries (LMIC). Supports logistic, linear, count, matched case-control, ordinal, multinomial, multilevel, Cox, parametric survival, and competing-risk regression, and absolute risk differences with the number needed to treat. Built upon widely accepted statistical methods, including logistic regression (Hosmer et al. 2013, ISBN:9781118548429), log-binomial regression (Spiegelman and Hertzmark 2005 ), Firth penalized logistic regression (Firth 1993 ), Poisson and robust Poisson regression (Zou 2004 ), negative binomial regression (Hilbe 2011, ISBN:9780521179515), Cox proportional hazards regression, parametric survival regression, causal mediation analysis, risk differences (Miettinen and Nurminen 1985 ), and linear regression (Kutner et al. 2005, ISBN:9780071122214). Leverages multiple dependencies to ensure high-quality output and generate reproducible, publication-ready tables in alignment with best practices in epidemiology and applied statistics.


R package for health research

gtregression

From model to manuscript. Fit regression and survival models, and get tables, forest plots and survival curves ready for your paper, without hand-formatting a single coefficient.

install.packages("gtregression")

gtregression logo

R-CMD-check CRANstatus CRANdownloads Codecov Lifecycle:stable DOI

What you can make

New in 1.2.0

Risk difference and NNT risk_difference() reports absolute risks, the risk difference and NNTB/NNTH, crude or adjusted.

More study designs Matched case-control, multilevel, ordinal, multinomial and competing-risk regression tables.

Richer survival tools Proportional-hazards plots, delayed entry, clustering, weights and adjusted survival curves.

Better merging Merge any number of tables, keep each block’s notes, and choose a table theme.

Read the full list of changes.

From data to manuscript

01

Prepare

Check variables, labels, levels and missing data.

dissect() Analysis-ready data

02

Describe

Build a clear baseline table before modelling.

descriptive_table() Table 1

03

Model

Fit crude, adjusted, stratified or survival models.

uni_reg() multi_reg() Effect estimates

04

Interpret

Check assumptions, confounding, interaction and fit.

check_ph() compare_models() A defensible model

05

Publish

Merge, visualise and export.

merge_tables() save_table() Manuscript-ready output

A five-minute example

library(gtregression)
library(dplyr)

data("data_birthwt", package = "gtregression")

birthwt <- data_birthwt |>
  mutate(
    race = factor(race, levels = c(1, 2, 3), labels = c("White", "Black", "Other")),
    smoke = factor(smoke, levels = c(0, 1), labels = c("No", "Yes")),
    ht = factor(ht, levels = c(0, 1), labels = c("No", "Yes")),
    low = factor(low, levels = c(0, 1), labels = c("Normal BW", "Low BW"))
  )

attr(birthwt$smoke, "label") <- "Smoking during pregnancy"
exposures <- c("age", "lwt", "race", "smoke", "ht")

# Baseline characteristics by outcome
desc <- descriptive_table(birthwt, exposures = exposures, by = "low",
                          show_dichotomous = "all_levels")

# One model per exposure, then one adjusted model
crude <- uni_reg(birthwt, outcome = "low", exposures = exposures, approach = "logit")
adjusted <- multi_reg(birthwt, outcome = "low", exposures = exposures, approach = "logit")

# One table for the paper, and a forest plot
table_2 <- merge_tables(desc, crude, adjusted,
                        spanners = c("Low birth weight", "Crude", "Adjusted"))
forest <- forest_reg(forest_df(crude, adjusted))

# Save
save_table(table_2, filename = "table-2", format = "docx")
save_forest(forest, filename = "forest-plot", format = "png")

Variable labels set with attr(x, "label") or labelled::var_label() appear in every table and plot. Each result keeps its fitted models (adjusted$models) and table data (adjusted$table_body), so nothing is hidden.

Find your way

Built on trusted R packages

gtregression is a readable interface over established packages: stats, survival, MASS, risks and logistf fit the models; broom, sandwich and lmtest handle inference; flextable, officer and gt build the tables; ggplot2, patchwork and forestploter draw the figures. The fitted models stay inside every result, so each number can be traced back to its source.

Install

# CRAN
install.packages("gtregression")

# Development version
remotes::install_github("ThinkDenominator/gtregression")

Citation

If you use gtregression in your work, please cite it as:

Polani R, Eliyas SK, Sakthivel M, Kaviprawin M, Krishnamoorthy Y, Majella MG. gtregression: Tools for Creating Publication-Ready Regression Tables. Zenodo. https://doi.org/10.5281/zenodo.16905349

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("gtregression")

1.2.0 by Rubeshkumar Polani, 6 days ago


https://gtregression.thinkdenominator.com/, https://github.com/ThinkDenominator/gtregression


Report a bug at https://github.com/ThinkDenominator/gtregression/issues


Browse source code at https://github.com/cran/gtregression


Authors: Rubeshkumar Polani [aut, cre] (ORCID: , Salin K Eliyas [aut] , Manikandanesan Sakthivel [aut] (ORCID: , Mogan Kaviprawin [aut] , Yuvaraj Krishnamoorthy [aut] (ORCID: , Marie Gilbert Majella [aut] (ORCID:


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports dplyr, risks, purrr, MASS, rlang, stats, lmtest, patchwork, ggplot2, utils, sandwich, tibble, broom, broom.helpers, gt, officer, flextable, scales, forestploter, logistf, survival, cmprsk, lme4, ordinal, nnet

Suggests haven, testthat, knitr, rmarkdown, car, ggtext, htmltools, jsonlite, shiny, rstudioapi, DT, readxl, rio


See at CRAN