Hello R-helpers,
I'm looking for a way to rename strips in lattice plots when I have more
than one conditionning variable.
Here's a dummy example taken from
http://casoilresource.lawr.ucdavis.edu/drupal/node/510
library(lattice)
f <- function(a, b, x) {p <- (exp(a + b*x)) / (1 + exp(a + b*x))}
x.seq <- seq(-5, 5, by=0.5)
x <- rep(x.seq, 9)
a.seq <- c(-2, 0, 2)
b.seq <- c(-1, -0.5, -0.25)
d <- expand.grid(a=a.seq, b=b.seq, x=x.seq, KEEP.OUT.ATTRS=FALSE)
d$p <- f(d$a,d$b,d$x)
rx <- runif(min=-5, max=5, n=20)
rd <- expand.grid(a=a.seq, b=b.seq, x=rx, KEEP.OUT.ATTRS=FALSE)
rd$rp <- rbinom(n=length(rd$x), 1, 0.5)
d$rp <- NA
rd$p <- NA
dd <- make.groups(d, rd)
xyplot(p + rp ~ x | factor(a) + factor(b),
data=dd,
ylab='Probability',
xlab='Predictor Variable',
panel=panel.superpose,
distribute.type=TRUE,
col=c(1,2), lwd=c(2,1), type=c('l','p'), pch=c(NA, '|')
)
Simply put, what I'd like to be able to do is change the strip names to
include for example "a=-2","a=0","a=2" and
"b=-1","b=-0.5","b=0.25"
In advance thanks for helping.
Cheers,
David Gouache
ARVALIS - Institut du Végétal
Service Génétique Physiologie et Protection des Plantes
IBP - Université Paris Sud
Rue de Noetzlin - Bât. 630
91405 - ORSAY CEDEX (Adresse Postale)
91190 - GIF SUR YVETTE (Adresse GPS, livraison)
Tél : +33.(0)1.69.93.85.60
Port : +33.(0)6.86.08.94.32
Fax : +33.(0)1.69.93.85.69
[[alternative HTML version deleted]]