[R] Boxplot using Formula
Matt Goff
goff at nawwal.org
Sun Apr 9 02:43:30 CEST 2006
I am trying to use the formula interface for the boxplot.
Currently running R 2.2.1 on Windows XP.
The problem is that boxplot is displaying groups that are empty in the
plot.
The following example demonstrates what it is happening (though my actual
situation is a little more complicated):
> data<-data.frame(values=c(1:25), groups=rep(c("A","B","C","D","E"),
> each=5))
> boxplot(data$values~data$groups, subset=data$groups!="C")
The plot includes a space for level "C" with no boxplot. I would like to
have only those levels with associated boxplots be shown in the figure.
So in this case, there should only be values "A", "B", "D", and "E" evenly
spaced along the horizontal axis.
I am a little confused because I am reusing old code and I don't remember
having this issue before, so perhaps there have been some changes in the
behavior of the boxplot function since the last time I use the code.
It seems like there's probably a simple solution, but I'm not seeing it.
Thanks,
Matt Goff
More information about the R-help
mailing list