[R] xyplot multiple conditions and empty panels
Deepayan Sarkar
deepayan.sarkar at gmail.com
Fri Feb 6 23:12:57 CET 2009
On Fri, Feb 6, 2009 at 1:15 PM, Sebastien Bihorel
<Sebastien.Bihorel at cognigencorp.com> wrote:
> Dear R-users,
>
> Is it possible to prevent xyplot from drawing empty panels when using
> multiple conditions and when the dataset has a incomplete set of condition
> combinations - like in the following example?
> I have tried to modify the drop.unused.levels argument but without any
> success.
> Any help and suggestions will be appreciated.
>
> Sebastien
>
> ####
> df <- data.frame(id=c(1,1,2,2,1,1,3,3,4,4),
> grp=c(1,1,1,1,2,2,2,2,2,2),
> x=1:10,
> y=1:10,
> z=jitter(1:10))
> xyplot(y+z~x|id*grp,
> data=df,
> type=c("p","l"),
> distribute.type = T,
> pch=3,
> col=c(1,2),
> xlab="x axis",
> ylab="y axis")
> ####
Levels are dropped for individual terms, not their combinations. If
you mean to use the combination as a term, do so explicitly:
xyplot(y+z~x | interaction(id, grp), df)
-Deepayan
More information about the R-help
mailing list