Skip to contents

Publication-ready regression and survival analysis tables, plots, and forest plots for real-world health data. Fit models, compare estimates, visualise results, and export manuscript-ready outputs without hand-formatting every coefficient.

Start the workflowExplore functions

Publication-Ready Regression, Survival, and Mediation Outputs

gtregression helps you move from model to manuscript: fit regression models, produce clean tables, visualise estimates, merge outputs, and export results without hand-formatting every coefficient.

It supports logistic, log-binomial, Poisson, robust Poisson, negative binomial, linear, Cox, parametric survival, and causal mediation workflows, including adjusted and stratified models.

Build What you get
Descriptive tables Grouped summaries with row or column percentages
Regression tables Crude, adjusted, stratified, linear, Cox, and parametric survival outputs
Survival analysis Kaplan-Meier curves, survival summaries, RMST, log-rank tests, Cox PH checks, and survival predictions
Mediation analysis Direct, indirect, total, and proportion mediated effects with causal caveats
Visualisations Regression plots, survival curves, fitted survival curves, and forest tables
Interpretation helpers Confounding, interaction, mediation, convergence, collinearity, model selection, and survival diagnostics
Exports HTML, PDF, PNG, and Word-ready outputs

DescribeBuild baseline tables with grouped summaries.

ModelFit crude, adjusted, and stratified regressions.

VisualiseCreate plots and forest tables for estimates.

ExportSave polished tables, figures, and Word outputs.

Why It Exists

Many students, researchers, and public health analysts need regression outputs that are readable, reproducible, and report-ready. gtregression keeps the R syntax approachable while preserving transparent model objects underneath.

Built on Trusted R Packages

gtregression is intentionally a readable interface over established R packages. The package uses widely trusted modelling, tidying, plotting, and reporting tools so users can inspect fitted models and understand the statistical engines behind each output.

Area Core packages used
Data handling and tidy workflows dplyr, purrr, tibble, rlang
Model fitting stats, MASS, survival, risks, logistf
Robust and diagnostic inference sandwich, lmtest, broom, broom.helpers
Tables and Word-ready reporting flextable, officer, gt
Figures and forest plots ggplot2, patchwork, forestploter, scales
Optional development and checking tools testthat, knitr, rmarkdown, pkgdown, car, forcats, ggtext

The user-facing functions return objects with fitted models, table bodies, and display metadata that advanced users can audit, modify, or reuse.

Install

install.packages("gtregression")

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

Five-Minute Workflow

library(gtregression)
library(dplyr)

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

birthwt_data <- 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")),
    ui = factor(ui, levels = c(0, 1), labels = c("No", "Yes")),
    low = factor(low, levels = c(0, 1), labels = c("Normal BW", "Low BW"))
  )

exposures <- c("age", "lwt", "race", "smoke", "ht", "ui")

attr(birthwt_data$age, "label") <- "Maternal age"
attr(birthwt_data$lwt, "label") <- "Maternal weight"
attr(birthwt_data$smoke, "label") <- "Smoking during pregnancy"

desc <- descriptive_table(
  birthwt_data,
  exposures = exposures,
  by = "low",
  percent = "column",
  show_overall = "last"
)

uni <- uni_reg(
  birthwt_data,
  outcome = "low",
  exposures = exposures,
  approach = "logit"
)

multi <- multi_reg(
  birthwt_data,
  outcome = "low",
  exposures = c("smoke", "ht", "ui"),
  adjust_for = c("age", "lwt", "race"),
  approach = "logit"
)

plot_reg(multi, title = "Adjusted Regression for Low Birth Weight")

Variable labels set with attr(x, "label") or labelled::var_label() are used automatically in display tables and plots, while original column names remain available internally for merging, modification, and testing.

Objects stay inspectable:

desc$table
uni$table
multi$table
multi$models

Optional model-fit statistics can be requested without changing the publication table:

uni_stats <- uni_reg(
  data = birthwt_data,
  outcome = "low",
  exposures = exposures,
  approach = "logit",
  model_stats = TRUE
)

uni_stats$model_stats

Browse by Task

Task Start here
First workflow Start Here
Descriptive summaries Descriptive Tables
Regression tables Regression Tables
Survival analysis Survival Analysis
Causal mediation Causal Mediation
Visualise estimates Visualise Results
Stratified models Stratified Analysis
Diagnostics and selection Diagnostics
Confounding and interaction Interpret
Merge and export Customize and Export

Citation

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

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

Acknowledgements

gtregression builds on the R ecosystem, especially stats, survival, MASS, risks, logistf, broom, broom.helpers, sandwich, lmtest, dplyr, purrr, tibble, rlang, flextable, officer, gt, ggplot2, patchwork, forestploter, and scales.