1 year ago
#345914
brozka
How to add pairwise comparisons to ggplot with three independent sample comparisons in 4 groups? Could anyone help me?
Could anyone help me, how to add pairwise comparisons to ggplot with three independent sample comparisons (type) in 4 groups? (variable) Thank you
Code is below:
compare_means(value ~ type, data = mean_carry,
group.by = "variable")
# Box plot facetted by "variable"
my_comparisons <- list( c("skilled", "elite"), c("skilled", "pro"), c("pro", "elite") )
p <- ggboxplot(mean_carry, x = "variable", y = "value",
color = "type", palette = "jco",
add = "jitter") + stat_compare_means(aes(group = type), label = "p.format")
p
Data are here: > dput(mean_carry) structure(list(type = c("skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "elite", "elite", "elite", "elite", "elite", "elite", "elite", "elite", "pro", "pro", "pro", "pro", "pro", "pro", "pro", "pro", "pro", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "elite", "elite", "elite", "elite", "elite", "elite", "elite", "elite", "pro", "pro", "pro", "pro", "pro", "pro", "pro", "pro", "pro", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "elite", "elite", "elite", "elite", "elite", "elite", "elite", "elite", "pro", "pro", "pro", "pro", "pro", "pro", "pro", "pro", "pro", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "skilled", "elite", "elite", "elite", "elite", "elite", "elite", "elite", "elite", "pro", "pro", "pro", "pro", "pro", "pro", "pro", "pro", "pro"), variable = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L), .Label = c("pw_mean_carry", "8i_mean_carry", "5i_mean_carry", "DR_mean_carry"), class = "factor"), value = c(115.26, 117.16, 106.92, 112.44, 107.96, 107.8, 102.66, 105.78, 111.16, 113.92, 111.58, 140.36, 109.76, 114.44, 121.5, 130.48, 130.34, 134.56, 129.38, 122.52, 127.16, 117.06, 118.32, 117.1, 110.95, 119.44, 107.92, 136.9, 132.16, 144.76, 129.3, 131.74, 111.24, 116.9, 122.36, 135.46, 135.5, 136.6, 167.28, 143.02, 138.14, 151.3, 157.9, 143.54, 161.34, 147.48, 138.62, 153.05, 139.8, 141.96, 142.66, 142.72, 148.18, 155.1, 148.42, 133.54, 185.5, 153.06, 153.26, 121.38, 140.04, 154.08, 161.84, 148.58, 152.96, 195.12, 167.28, 154.76, 165.92, 176.74, 160.82, 172.3, 178.64, 168.5, 184.58, 171.24, 181.64, 167.38, 150.8, 181.34, 156.525, 197.68, 195.78, 247.18, 205.16, 205.92, 186.9, 185.24, 211.2, 210, 191.08, 208.26, 252, 207.78, 237.84, 214.56, 236.44, 210.1, 222.88, 269.125, 213.3, 273.56, 262.7, 254.94, 234.76, 226.64, 264.08, 273.58)), row.names = c(NA, -108L), class = "data.frame")
r
ggplot2
graph
comparison
pairwise
0 Answers
Your Answer