Hi:

Try this:

First put your data into a data frame (it's not necessary, but it's easier)

ol <- data.frame(grp = grp, size = size)
boxplot(size ~ grp, data = ol, style = 'att', medpch = "o",
      ylab = "Prostate Volume (cm3)")
mns <- with(ol, tapply(size, grp, mean))
points(1:5, mns, pch = '+')

HTH,
Dennis

On Wed, Jan 6, 2010 at 1:36 PM, oscar linares <wins...@gmail.com> wrote:

>  Dear Rexperts,
>
>  I am trying to add a '+' identifying the mean in a boxplot using the
>   following
>   sizelist <- split(size, grp)
>   centers <- boxplot(sizelist, style.bxp = "att", medpch = "o",
>       ylab = "Prostate Volume (cm3)")
>   points(centers, unlist(lapply(sizelist, mean)), pch = "+")
>   But, I get error
>   Error in xy.coords(x, y) : 'x' and 'y' lengths differ
>   which I do not understand.
>   The data follows
>   grp    size
>   AE    9.132
>   AE    10.07
>   AE    20.077
>   AE    14.691
>   AE    23.698
>   E1    10.356
>   E1    6.313
>   E1    21.708
>   E1    12.651
>   E1    15.464
>   E2    37.2
>   E2    12.639
>   E2    16.791
>   E2    36.996
>   E2    22.808
>   CC    1.975
>   CC    3.125
>   CC    4.433
>   CC    6.154
>   CC    4.175
>   NC    9.301
>   NC    13.531
>   NC    12.84
>   NC    14.336
>   NC    25.102
>
>   Please help.
>
> --
> Oscar
> Oscar A. Linares, MD
> Translational Medicine Unit
> LaPlaisance Bay, Bolles Harbor
> Monroe, Michigan 48161
>
> Department of Medicine,
> University of Toledo College of Medicine
> Toledo, OH 43606-3390
>
> Department of Internal Medicine,
> The Detroit Medical Center (DMC)
> Harper University Hospital
> Wayne State University School of Medicine
> Detroit, Michigan 48201
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to