plot_corpairs() is a small ggplot2 consumer for tables returned by
corpairs(). It does not compute correlation pairs, fit intervals, or choose
a correlation layer. Build the table first with corpairs(), then pass that
table to this helper.
Arguments
- data
A data frame returned by
corpairs(), or a compatible table with columnslevel,class,parameter,estimate, andmodelled.conf.statusandinterval_sourceare optional for point-only tables, but finite intervals are drawn only when those columns mark a supported interval.- colour
Optional character scalar naming a column to map to colour. Use
NULLto suppress colour mapping.- facet
Optional character scalar naming a column to facet by. Use
NULLto suppress faceting.- label
Optional character scalar naming a column to use for y-axis row labels. Use this for publication figures where the full
level | class | parameterlabel is too long. IfNULL, labels are built fromlevel,class, andparameter.- interval
Logical; draw finite
conf.low/conf.highintervals when those columns are present.- ...
Reserved for future options.
Details
The helper draws one point per correlation row. If the table contains finite
conf.low and conf.high bounds plus interval provenance columns that
describe a real interval, it draws interval segments for those rows only. Rows
without supported bounds remain visible as point estimates and keep their
display interval status attached to the plotted data.
Examples
pairs <- data.frame(
level = c("residual", "group"),
class = c("residual", "mean-slope"),
parameter = c("rho12", "cor((Intercept),x | p | id)"),
estimate = c(0.25, 0.45),
modelled = c(FALSE, FALSE),
conf.low = c(NA, 0.10),
conf.high = c(NA, 0.72),
conf.status = c("not_requested", "profile"),
interval_source = c("not_available", "profile")
)
if (requireNamespace("ggplot2", quietly = TRUE)) {
plot_corpairs(pairs)
plot_corpairs(pairs, facet = "level")
}