I have the following data frame:
test2 <- data.frame(groups = c(rep(\"group1\",4), rep(\"group2\",4)), X2 = c(rnorm(4), rnorm(4)) , label = c(re
Try using ggpubr. It creates ggplot2-like charts.
library(ggpubr) ggbarplot(test2, x = "label", y = "X2", add = "mean", fill = "groups")
Alternatively, add a facet:
ggbarplot(test2, x = "label", y = "X2", add = "mean", fill = "groups", facet.by = "groups")