[R] Dropping 'empty' panels from lattice

Deepayan Sarkar deepayan.sarkar at gmail.com
Tue Apr 28 18:21:41 CEST 2009


On 4/28/09, amvds at xs4all.nl <amvds at xs4all.nl> wrote:
> How would I paste factors c1...c10 to one grouping factor?
>
>  Can you give an example?

In this case interaction would be conceptually more appropriate

histogram(~Oversized | with(dat, interaction(c1, c2, c5, c6, c7, c8, c9, c10)),
          nint=21,layout=c(32,8),data=dat,type="count")

but

   with(dat, paste(c1, c2, c5, c6, c7, c8, c9, c10, sep = ":"))

should also work.

-Deepayan


>  Thanks much!
>  Alex
>
>
>
>  >  <amvds <at> xs4all.nl> writes:
>  >
>  >>
>  >> I have 8 cofactors possibly affecting one and only one variable.
>  >>
>  >> I make conditional histograms:
>  >>
>  >> <-pdf(file="tst3.pdf",paper="special",width=36,height=36)
>  >>
>  > <-histogram(~Oversized|dat$c1*dat$c2*dat$c5*dat$c6*dat$c7*dat$c8*
>  >   dat$c9*dat$c10,nint=21,layout=c(32,8),data=dat,type="count")
>  >> <-dev.off()
>  >>
>  >> This works (compliments to R developers!) but it does generate a large
>  >> plot with many panels being 'empty', e.g. that combination of factors
>  >> c1..c10 never occurs in this data set.
>  >>
>  >> Is there a way to autmatically drop those empty panels?
>  >>
>  >
>  > Since there is little hope that you get a useful arrangement in the
>  > 2D-paper world, and neither in 4D relativistic space, I would
>  > suggest to make a new factor by pasting all cX factors, use that
>  > as the only grouping factor.
>  >
>  > Dieter
>  >
>  > ______________________________________________
>  > R-help at r-project.org mailing list
>  > https://stat.ethz.ch/mailman/listinfo/r-help
>  > PLEASE do read the posting guide
>  > http://www.R-project.org/posting-guide.html
>  > and provide commented, minimal, self-contained, reproducible code.
>  >
>
>  ______________________________________________
>  R-help at r-project.org mailing list
>  https://stat.ethz.ch/mailman/listinfo/r-help
>  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>  and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list