[R] ggplot2 - boxplot of variables / columns

Andreas Christoffersen achristoffersen at gmail.com
Tue Apr 21 17:48:07 CEST 2009


David, you solution
> qplot(ind, values, data=stack(data.frame(a,b,c)), geom="boxplot")
Works a treat - thank you!

Thierry, your solution
> ds <- data.frame(a = a, b = b, c = c)
> library(ggplot2) # loads qqplot2
> ggplot(melt(ds), aes(x = variable, y = value)) + geom_boxplot()
Also works.

I can even combine the two solutions, using stack / melt interchangeably.

I am very glad that today I both learned melt/stack and Thierry has
made me curious as to the finer ggplots fine tuning wizardry in ggplot
vs. the simple qplot.

Again - thx.




More information about the R-help mailing list