[R] Lattice strip labels for two factors

From: Rafael Duarte <rduarte_at_ipimar.pt>
Date: Fri 22 Sep 2006 - 19:36:40 GMT

Dear list,
My problem is to change the strip text of lattice panels when using two factors.
I have a data frame with two factors:

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)

I can make simple xyplot and change the text of the factor levels with strip.custom:

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")),


But how can I change the text of the factor levels when using both factors as in this plot:
xyplot( value ~ year | fact1*fact2, data=df, type="b")

(fact2 levels text should change to: c("faro","porto","lisbon","setubal"))

I read the help for strip.default and the emails archive, tried with
"which.given" but could not find out how to accomplish this.

Many thanks,
Rafael Duarte

Rafael Duarte
Marine Resources Department - DRM
IPIMAR -  National Research Institute for Agriculture and Fisheries
Av. Brasília, 1449-006 Lisbon  -  Portugal
Tel:+351 21 302 7000      Fax:+351 21 301 5948
e-mail: rduarte@ipimar.pt

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sat Sep 23 05:42:25 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 Fri 22 Sep 2006 - 20:30:46 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.