Forest Plots from Regression Models

Produces forest plots using 'ggplot2' from models produced by functions such as stats::lm(), stats::glm() and survival::coxph().


This is an R package to generate forest plots of the coefficients of models produced by lm, glm, survival::coxph, etc.

The main function is forest_model, with a helper function default_forest_panels to produce the necessary panels data.frame.


pretty_lung <- lung %>%
            Age = age,
            Sex = factor(sex, labels = c("Male", "Female")),
            ECOG = factor(lung$ph.ecog),
            `Meal Cal` =
print(forest_model(coxph(Surv(time, status) ~ ., pretty_lung)))


The package can be installed using install.packages. It needs Hadley Wickham's broom, dplyr, gpplot2 and lazyeval packages.

Development takes place on the github repository

Build Status AppVeyor Build Status


forestmodel 0.5.0 (2018-04-24)

  • Updated minimum version numbers for packages

forestmodel 0.4.4 (2017-04-28)

  • Fixed bug in forests_rma where the transformation wasn't being passed to default_forest_panels.

forestmodel 0.4.3 (2017-04-16)

  • Fixed a bug in forest_model which meant that non-synactic variable names (e.g. with spaces in the title) were dropped from the plot.
  • Now handles character columns as factors.
  • Fixed some incompatibilities with bind_cols in dplyr 0.6.

forestmodel 0.4.2 (2017-04-04)

  • Fixed a couple of issues in panel_forest_plot that produced warnings.

forestmodel 0.4.1

  • Fixed #5 issue regarding coxph models with a single predictor (thanks @vjd) for identifying the bug)

forestmodel 0.4.0 (2015-12-10)

  • Fixed problem with coxph models that used special functions.
  • Changed from forest_breaks to graphics::axisTicks for break calculation.

forestmodel 0.3.3

  • Added n_events and person_time variables to data for display when using a coxph model

forestmodel 0.3.2

  • Now handles logical covariates appropriately
  • Tweaks to break and limit calculation

forestmodel 0.3.1

  • Added option (set as default) to recalcluate panel widths
  • Added function to make custom panels easier to generate (forest_panels)
  • Tidied up parameters to make them more consistent between functions

forestmodel 0.3

  • Updated panel object to be a list of lists for greater flexibility
  • Added forest_rma function to produce forest plots from output of metafor::rma

forestmodel 0.1

  • Initial release

Reference manual

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


0.6.2 by Nick Kennedy, a year ago

Browse source code at

Authors: Nick Kennedy <[email protected]>

Documentation:   PDF Manual  

Task views: Meta-Analysis

GPL-2 license

Imports dplyr, broom, rlang, tibble

Depends on ggplot2

Suggests survival, metafor, labelled

Imported by ezcox, live, metawho.

Suggested by ricu.

See at CRAN