I have data of the form
x <- matrix(rnorm(600), nrow = 100, ncol = 6)
x <- cbind(x, c(rep(1, 50), rep(2, 50)))
colnames(x) <- c("a", "b", "c", "d", "e", "f", "group")
A boxplot (without the "outlying" dots) of each column can be made like this:
library(ggplot2)
x <- as.data.frame(x)
xmelt <- melt(x)
boxplot(data = xmelt, value~variable, outlwd = 0)
I would like to have a plot consisting of 6 groups of boxplots, grouped by "a", "b", ..., "f", where each group (e.g. "a") has the boxplots with the values of "a" for the different values of "group". This should be possible using ggplot2, but I keep getting errors. And as finishing touch the boxplots need to be coloured using the "group"-variable. Thus, above each letter "a", ..., "f" there is a group of 2 (or more if "group" takes on more different values") boxplots that take a color according to the "group" value.