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

Gabor Grothendieck ggrothendieck at gmail.com
Mon Sep 26 16:35:34 CEST 2011


On Mon, Sep 26, 2011 at 9:56 AM, Philip Rhoades <phil at pricom.com.au> wrote:
> 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 . .
>

Try replacing the stats component of boxplot's output with your
desired statistics and then feeding that into the lower level bxp
function to do the graphics:

bp <- boxplot(Nile, plot = FALSE)
bp$stats <- matrix(c(min(Nile), mean(Nile) + c(-1, 0, 1) * sd(Nile), max(Nile)))
bxp(bp)


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list