Re: [R] Lattice strip labels for two factors

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Tue 26 Sep 2006 - 21:47:37 GMT

On 9/26/06, Joe Moore <emgt_r@hotmail.com> wrote:
> Dear All:
>
> In the following code which I modified from previous question,

Perhaps you should also have checked if it runs after the modification.

> in addition
> to show the fact1 level names (y, b, r) in strips, I also want to have a
> color bar to indicate the state of every panel (in this example, y
> correspods to 1, and b, r correspond to 0). Does anyone have a quick
> solution?

No, but this might give you a hint (you need to write a suitable panel function):

xyplot(value ~ year | fact1:factor(state),

       data=df, type="b",
       subset= fact2=="far",
       layout=c(1,3))

Deepayan

>
> Thanks
>
>
>
>
>
> df <- expand.grid("fact1"=c("y","b","r"),
> "fact2"=c"far","por","lis","set"), "year"=1991:2000, "value"= NA)
> df[,"value"] <- sample(1:50, 120, replace=TRUE)
> df$state <- 0
> df$state[df$fact1=="y"] <- 1
>
> require("lattice")
> xyplot( value ~ year | fact1, data=df, type="b", subset= fact2=="far",
> strip = strip.custom(bg=gray.colors(1,0.95),
> factor.levels=c("yellow", "black", "red")), layout=c(1,3))
>



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 and provide commented, minimal, self-contained, reproducible code. Received on Wed Sep 27 07:53:50 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 26 Sep 2006 - 23:30:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.