[R] subset and boxplots

Sebastian P. Luque spluque at gmail.com
Tue Apr 22 18:29:33 CEST 2008


On Tue, 22 Apr 2008 07:55:41 -0800,
"Marlin Keith Cox" <marlinkcox at gmail.com> wrote:

> R users, This should be simple, but I cannot figure it out.  I import
> test.csv, then create a subset for "brook_dis".  When I plot (week, R)
> I get a nice boxplot, but along the x axis, there are weeks a, b, c
> along with h and nh.

That's because the levels are still there.  To get rid of all them (for
all factors in the data frame):

sub[] <- lapply(sub, "[", drop=TRUE)

after subset()'ing.


-- 
Seb



More information about the R-help mailing list