Last chance! 50% off unlimited learning
Sale ends in
Prepares data for plotting boxes by calculating box boundaries based on category positions.
prepare_box_data(data, cat_a, cat_b, group, cat_a_order, cat_b_order)
A data frame with box boundaries for plotting.
A data frame containing the variables.
The name of the column representing category A.
The name of the column representing category B.
The name of the column representing the grouping variable.
A vector specifying the order of category A.
A vector specifying the order of category B.
library(dplyr)
data <- data.frame(
cat_a = rep(letters[1:3], each = 2),
cat_b = rep(LETTERS[1:2], times = 3),
group = rep(c("G1", "G2"), times = 3)
)
cat_a_order <- c("a", "b", "c")
cat_b_order <- c("A", "B")
prepare_box_data(data, "cat_a", "cat_b", "group", cat_a_order, cat_b_order)
Run the code above in your browser using DataLab