[R] Superposing data on boxplot

About this list Date view Thread view Subject view Author view Attachment view

From: Ted Harding (Ted.Harding@nessie.mcc.ac.uk)
Date: Wed 05 May 2004 - 00:48:23 EST


Message-id: <XFMail.040504154823.Ted.Harding@nessie.mcc.ac.uk>

Hi folks,

I have a vaiable Y and an associated factor Z at several (13)
levels.

  boxplot(Y~Z)

produces a nice array of boxplots, one for each level of Z,
and each duly labaelled with its level of Z.

I would like to superpose on each boxplot the actual data
points which it represents, i.e. do something conceptually
(though not in real R) expressed as

  points(Y~Z)

or

  points(Z,Y)

It can be done "with bare hands" along the lines of

  B<-boxplot(Y~Z)
  x<-bxp(B)
  X<-rep(x,ngroups)
  points(X,Y)

where ngroups is the number of data at each level of Z,
*provided* the data are pre-sorted by level of Z and in the
same order as these levels occurr in the boxplot. But of course
they're not!

OK, I could do this by hand as well, but now it's getting a bit
tedious, and I'm wondering if there's a better way.

Thanks for any suggestions,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 04-May-04 Time: 15:48:23
------------------------------ XFMail ------------------------------

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:07 EST