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

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu Aug 28 22:36:07 CEST 2008


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



More information about the R-help mailing list