[R] Boxplot using Formula

Dieter Menne dieter.menne at menne-biomed.de
Sun Apr 9 11:24:53 CEST 2006


Matt Goff <goff <at> nawwal.org> writes:

> 
> 
> The problem is that boxplot is displaying groups that are empty in the  
> plot.
> 

Call factor() again on the groups, which will drop levels. You can do that in an
extra line, or on-the-fly:

data<-data.frame(values=c(1:25), groups=rep(c("A","B","C","D","E"),
 each=5))
data = subset(data,groups!="C")

boxplot(values~factor(groups), data=data)




More information about the R-help mailing list