visualize\(associations\)forest

visualize association results as a forest plot

Description

Creates a publication-style forest plot for association results stored in a PolyGeniusAssociations object. The layout is: names | table.left | forest | table.right.

table.left and table.right are evaluated against the association result table columns only. Named expressions use their given names as headers; unnamed expressions use their expression text.

Usage

visualize.associations.forest(
  results,
  rows.by = predictor,
  group.by = outcome,
  table.left = c(),
  table.right = c(),
  width = NULL,
  row.colors = c("darkgreen", "white"),
  shade.tables = TRUE,
  row.height = 0.82,
  show.reference = TRUE,
  ...
)

Arguments

results

A PolyGeniusAssociations object.

rows.by

Unquoted expression selecting the row-label column. Defaults to predictor, but when not supplied explicitly the forest plot uses predictor when grouping by outcome, outcome when grouping by predictor, otherwise it uses outcome if there is only one predictor and multiple outcomes, and stratum if there is only one predictor, one outcome, and multiple strata.

group.by

Optional unquoted expression adding grouped header rows. When supplied, a header row is inserted for each group and the row labels are indented beneath it.

table.left

Unquoted expression or c(…) of expressions to display as columns to the left of the forest. Defaults to family-specific values when left as c(). Use NULL to suppress the left table entirely.

table.right

Unquoted expression or c(…) of expressions to display as columns to the right of the forest. Defaults to family-specific values when left as c(). Use NULL to suppress the right table entirely.

width

Optional numeric vector giving relative widths for the major layout blocks, in left-to-right order across the blocks that are present: names, optional table.left, forest, optional table.right. For example, when all blocks are present c(1, 1, 1, 1) gives equal block widths, while c(2, 1, 1, 1) makes the names block twice as wide as the others. When a side table is absent, omit its entry. When NULL, all present blocks use equal width.

row.colors

Length-2 character vector giving the alternating row background colors. Colors are internally rendered at 80% transparency.

shade.tables

Logical; if TRUE, apply the alternating row shading to the label and side-table columns. When FALSE, the forest rows keep their shading but the surrounding text tables are left unshaded.

row.height

Relative row height within the forest layout. Values below 1 leave whitespace between rows; the default keeps rows slightly taller than the text without filling the entire vertical interval.

show.reference

Logical; if TRUE, draw the null/reference line.

Reserved for future extensions.

Value

A patchwork/ggplot object.