From ?boxplot we see that we have the ability to transfer several data vectors as elements of a list, and we will get several boxes, one for each vector in our list.
So, all we need to do is convert the columns of our matrix to a list:
m <- matrix(1:25,5,5) boxplot(x = as.list(as.data.frame(m)))
If you really need separate panels with one drawer (although, to be honest, I donโt understand why you want to do this), I will go to ggplot and cut instead:
m1 <- melt(as.data.frame(m)) library(ggplot2) ggplot(m1,aes(x = variable,y = value)) + facet_wrap(~variable) + geom_boxplot()
joran
source share