[R] Impaired boxplot functionality - mean instead of median

Marc Schwartz (via MN) mschwartz at mn.rr.com
Thu Dec 1 20:59:03 CET 2005

```> Marc Schwartz (via MN) Ð¿Ð¸ÑˆÐµÑ‚:
> > On Thu, 2005-12-01 at 19:40 +0300, Evgeniy Kachalin wrote:
> >
> >>Martin Maechler Ð¿Ð¸ÑˆÐµÑ‚:
>
> >>So I analize genetics data. I have some factor (gene variant, c(1,2,3))
> >>and the quantitative variable corresponding to that factor. How do I
> >>visualize this situation? Compare mean of samples corresponding to
> >>factor values?
> >>
> >>Should boxplot support 'mean-in-the-middle', it would fit my needs
> >>ideally. How do I plot mean +/- SD plot?
> >>
> >>Also there is a way to rewrite boxplot.stats and replace "fivenum" there
> >>boxplot.formula (or boxplot.default?) function. And all this stuff would
> >>not be configurable. I'm still novice in R, so I need simple way to
> >>pre-visualize my data and estimate approximate result.
> >
> >
> > If you want means and SDs, you might want to look at:
> >
> > 1. plotCI() and plotmeans() in the gplots package
>
> So plotmeans is incapable of: boxplot(numerical~fact1+fact2). Is there
> any way further?

I think that somehow we are talking past each other here.

plotmeans() does what it is designed to do, which is to simplify the
process of plotting group-wise point estimates and user defined error
bars/intervals around the point estimates.

In your case, these intervals would be standard deviations around each
of the group means as you have indicated.

Review the examples in ?plotmeans.

As Martin and others have pointed out, you need to remove boxplots from
the equation here, as they were not designed to plot means and standard
deviations.

HTH,

Marc Schwartz

```