Re: [R] help with strip.default

From: Berton Gunter <gunter.berton_at_gene.com>
Date: Sat 07 Jan 2006 - 03:48:38 EST


Steve:

This is a question for **super Deepayan,** and hopefully he'll respond.

However, in the interim, let me give it a shot. Basically, I think what you've asked for falls outside the bounds of what lattice is designed to do. But I think there's a simple way to fool it. Basically what you need to do is to combine your two factors into one with level names and ordering as you want. See ?factor (?ordered may also be useful, but you don't need it). For example:

comb.factor=factor(paste(A,B,sep='.'))

As I said, you may have to reorder the levels from the default that factor() gives you to get your panels to display the way you want. Also see the perm.cond and index.cond arguments of xyplot, which might also suffice for that purpose.

Again, Deepayan will hopefully suggest a cleverer way that I missed. But I think this approach will get you what you want.

Cheers,
Bert

"The business of the statistician is to catalyze the scientific learning process." - George E. P. Box    

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Steven Lacey
> Sent: Friday, January 06, 2006 8:20 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] help with strip.default
>
> Hi,
>
> I am creating a multi-conditioned trellis plot. My data look
> something like
> this:
>
> Factor A Factor B IV DV
> X 1
> X 2
> X 3
> X 4
> Y 1
> Y 2
> Y 3
> Y 5
> Z 1
> Z 2
> Z 3
> Z 4
>
> In one sense these data are suitable for trellis because for
> every level of
> factor A there are four levels of factor B. However, the
> names of the factor
> B levels depend on the level of factor A.
>
> How would I create a 3 x 4 trellis plot where each panel is a
> combination of
> factor A and factor B where the names of factor B are
> preserved and the
> strip has two levels, one for factor A and another for factor B?
>
> This was more difficult than I thought because trellis wants
> to generate 15
> panels, as there are 3 levels of factor A and 5 levels of
> factor B. But
> these 5 levels of factor B are in name only. There are only 4
> different
> levels of factor B for each level of factor A.
>
> As a work around I am considering renaming the levels in
> factor A from 1 to
> 4 for all levels of factor B. Then, write a custom
> strip.default to specify
> the names. However, I am not sure how to write this function.
> Would someone
> help me get started?
>
> Thanks,
> Steve
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jan 07 03:56:14 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:54 EST