[R] Boxplot BUT with Mean, SD, Max & Min ?

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Mon Sep 26 16:15:50 CEST 2011


Dear Phil,

Have a look at the ggplot2 package.

library(ggplot2)
#classic boxplot
ggplot(mtcars, aes(x = factor(cyl), y = mpg)) + geom_boxplot()

#custom boxplot
myboxplot <- cast(cyl ~ ., value = "mpg", data = mtcars, fun = c(min, max, sd, mean))
ggplot(myboxplot, aes(x = factor(cyl))) + geom_boxplot(aes(lower = mean - sd, upper = mean + sd, middle = mean, ymin = min, ymax = max), stat = "identity")

Best regards,

Thierry


> -----Oorspronkelijk bericht-----
> Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
> Namens Philip Rhoades
> Verzonden: maandag 26 september 2011 15:57
> Aan: r-help op stat.math.ethz.ch
> Onderwerp: [R] Boxplot BUT with Mean, SD, Max & Min ?
> 
> People,
> 
> It appears that there is no way of getting Boxplots to plot using Mean, SD, Max
> & Min - is there something else that would do what I want?  I couldn't find it . .
> 
> Thanks,
> 
> Phil.
> --
> Philip Rhoades
> 
> GPO Box 3411
> Sydney NSW	2001
> Australia
> E-mail:  phil op pricom.com.au
> 
> ______________________________________________
> R-help op r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list