risk_of_bias_plot.RdDraws a study-level traffic-light plot of risk-of-bias judgments and a component-level stacked bar plot of percentages (Low, Unclear, High).
risk_of_bias_plot(
data,
study,
component,
decision,
study_order = NULL,
component_order = NULL,
main_traffic = "Risk of Bias (Study Level)",
main_aggregate = "Risk of Bias by Component (%)",
low_col = "#2E8B57",
unclear_col = "#F0C419",
high_col = "#C0392B",
cex_axis = 0.85,
cex_main = 1,
study_legend_position = "top",
aggregate_legend_position = "top",
study_legend_title = NULL,
aggregate_legend_title = NULL,
legend_inset = c(0, -0.13),
main_traffic_adj = 0.5,
main_aggregate_adj = 0.5,
plot = c("both", "study", "aggregate"),
separate_plots = FALSE,
aggregate_horizontal = FALSE
)A data frame in long format.
Character string naming the study ID column.
Character string naming the risk-of-bias component/domain column.
Character string naming the judgment column. Values are matched to \code"Low", \code"Unclear", and \code"High" (case-insensitive). Common misspellings such as \code"uncler" are accepted.
Optional character vector with custom study order.
Optional character vector with custom component order.
Title for the traffic-light panel.
Title for the aggregate stacked-bar panel.
Color used for low risk.
Color used for unclear risk.
Color used for high risk.
Axis text scaling.
Main title scaling.
Legend position for the study panel. Use
"none" to suppress.
Legend position for the aggregate panel.
Use "none" to suppress.
Optional legend title for the study panel.
Optional legend title for the aggregate panel.
Numeric legend inset passed to legend.
Horizontal title alignment in [0, 1] for the
study panel title.
Horizontal title alignment in [0, 1] for
the aggregate panel title.
Which panel(s) to draw: \code"both", \code"study", or \code"aggregate".
Logical. If \codeTRUE and \codeplot = "both", the study-level and aggregate plots are drawn on separate plot pages.
Logical. If \codeTRUE, the aggregate percentages are drawn as horizontal stacked bars.
Invisibly returns a list containing: \describe \itemdecision_matrixStudy x component matrix with values \code"Low", \code"Unclear", or \code"High". \itemcountsComponent x decision count matrix. \itempercentagesComponent x decision percentage matrix (rows sum to 100).
Input data must be in long format with one row per study-component judgment.
rob_dat <- data.frame(
study = rep(paste0("Study_", 1:5), each = 4),
component = rep(c("Randomization", "Allocation", "Blinding", "Attrition"), 5),
decision = c(
"Low", "Low", "Unclear", "High",
"Low", "Unclear", "Unclear", "High",
"High", "High", "Unclear", "Low",
"Low", "Low", "Low", "Low",
"Uncler", "Low", "High", "Unclear"
),
stringsAsFactors = FALSE
)
risk_of_bias_plot(
data = rob_dat,
study = "study",
component = "component",
decision = "decision",
plot = "aggregate",
aggregate_horizontal = TRUE
)