[R] boxplot grouped by two variables.

Jonathan Rougier J.C.Rougier at durham.ac.uk
Tue Nov 21 18:10:51 CET 2000

Hi Vadik,

On Tue, 21 Nov 2000, Vadik Kutsyy wrote:

> Is there a quick way to make boxplots groups by two variables?  By that 
> I mean, that if x axes have values ("A","B","C"), than at each value 
> there would be a few boxplots each for a value of second variable (say 
> ("1","2","3")).

If I understand you correctly you want to try the "interaction" function
in a boxplot.  Your data needs to be organised into a data.frame with
appropriate factors.  Here's a simple example ...

boxplot(breaks~interaction(wool, tension), data=warpbreaks, col=2:3)

Hope this helps, Jonathan.

Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list