[R] drop.unused.levels for two factors {lattice}

Dylan Beaudette dylan.beaudette at gmail.com
Thu Aug 28 23:16:34 CEST 2008


On Thursday 28 August 2008, Deepayan Sarkar wrote:
> On Thu, Aug 28, 2008 at 1:21 PM, Dylan Beaudette
>
> <dylan.beaudette at gmail.com> wrote:
> > Hi,
> >
> > Is there any way to suppress plotting of panels that don't actually
> > contain any information? I have tried using 'drop.unused.levels=TRUE',
> > but there doesn't seem to be any effect. Here is an example:
> >
> > library(lattice)
> >
> > # some fake data:
> > d <- data.frame(x=runif(20), x.class=rep(letters[1:5], each=4),
> > f1=rep(letters[1:2], each=10), f2=rep(letters[10:19], each=2) )
> >
> > # plot it:
> > dotplot(x.class ~ x | f1 + f2, data=d, scales=list(relation='free'))
>
> No, you can only drop factor levels that are unused (anywhere). Try
>
>  dotplot(x.class ~ x | f1:f2, data=d, scales=list(relation='free'))
>
> You can use 'layout' and 'skip' to get to a layout similar to your
> original call, if you need to.
>
> -Deepayan

Thanks! that did the trick.

Dylan

-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341



More information about the R-help mailing list