Creates a faceted ggplot()
figure with boxplots per study site. Ignores
time/visit dependencies (will group data of all visits together).
Usage
fig_boxplots(
data,
xval = "site_code",
yval = "item_value",
text = "text_label",
color_fill = "significance",
sumval = NULL,
title = NULL,
x_title = "Site",
y_title = NULL
)
Arguments
- data
data frame.
- xval
Character vector with the x-axis variable.
- yval
Character vector with the y-axis variable.
- text
Character vector, text label variable. Not used by ggplot2, but can be used to display a text label on hover after converting the ggplot to a plotly object with
plotly::ggplotly()
.- color_fill
Character vector with the name of the column containing the categorical color scale.
- sumval
summary value, used to display a horizontal line
- title
Character vector, main figure title.
- x_title
x-axis title.
- y_title
y axis title.
Examples
fig_data <- data.frame(
"site_code" = sample(c("Site 1", "Site 2"), 50, replace = TRUE),
"item_value" = runif(50, 1, 100),
"subject_id" = sample(1:10, 50, replace = TRUE),
"text_label" = "test label",
"significance" = "test"
)
fig_boxplots(
fig_data,
sumval = 20,
title = "main_title",
y_title = "y-axis_title",
x_title = "x-axis_title"
)