Skip to contents

Each argument must be a forestplot() result (assign to a variable; do not rely on auto-print). Panels are captured with grid::grid.grabExpr() and combined with patchwork for knitr / HTML / PDF output.

Usage

compare_forestplots(
  ...,
  ncol = NULL,
  nrow = NULL,
  widths = NULL,
  heights = NULL,
  align = TRUE,
  labels = NULL,
  draw = FALSE
)

Arguments

...

Two or more objects of class interactmeta_forestplot from forestplot().

ncol

Number of columns in the layout. Default: all panels in one row.

nrow

Optional number of rows. If NULL, inferred from ncol.

widths

Optional relative column widths passed to patchwork::plot_layout().

heights

Optional relative row heights passed to patchwork::plot_layout().

align

If TRUE, use a shared xlim / xticks and identical capture size for each panel (recommended for AD vs DA comparisons).

labels

Optional character vector of panel captions (one label per forest, in layout order: left-to-right, then top-to-bottom). Rendered as patchwork panel tags (top-left of each panel). NULL (default) omits tags.

draw

If TRUE, print the layout on the active graphics device.

Value

A patchwork object (invisibly if draw = TRUE).

Details

When align = TRUE (default), plots share a common effect-axis range and are captured at the same width and height so rows and x-axes line up.

For pooled estimates across methods (DA, SWADA, CAMS), use compare_modifiers() or compare_interactions() instead.

Examples

if (FALSE) { # \dontrun{
fit <- da(my_data, reference = "ref")
fp_mod <- forestplot(fit, exponentiate = TRUE)
fp_int <- forestplot(fit, type = "interaction", exponentiate = TRUE)
compare_forestplots(fp_mod, fp_int, labels = c("Modifiers", "Interaction"))
} # }