Bert,
A little bit of experimentation and I got this:
library(lattice)
x <- 1:10
y <- runif(1:10)
f <- factor(rep(1:2,5))
xyplot(y ~ x | f,
strip = function(which.panel, factor.levels,...){
lab <- c("a","b") #[which.panel]
strip.default(factor.levels = lab,
which.panel = which.panel, style=1,...)}
)
The help page says about factor.levels:
factor.levels
vector of character strings or expressions giving the levels of the
conditioning variable currently being drawn....
which suggested it wanted the full list. I think by selecting the one
with which.panel, it may have been looking for the second one in
the vector, but each time the vector was of length 1. Just idle
speculation though...
Ken
Quoting Bert Gunter <gunter.ber...@gene.com>:
Ken:
I would have thought so, too. However:
x <- 1:10; y <- runif(1:10); f <- factor(rep(1:2,5))
xyplot(y~x|f, strip= function(which.panel,factor.levels,...){
lab <- c("a","b")[which.panel]
strip.default(factor.levels=lab,which.panel=which.panel,style=1,...)} )
produces label "a" for the first panel, but "NA" for the second. (see
sessionInfo() below).
This appears to be a bug to me; however, given lattice's maturity, I
am afraid it may well be user error -- in particular, my failure to
parse the Help correctly. Thoughts?
Incidentally, try using strip.custom() instead. I am so far completely
at a loss to understand what is happening there. Your insight would be
greatly appreciated.
R version 2.15.2 (2012-10-26)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] datasets splines grid tcltk stats graphics
grDevices utils methods
[10] base
other attached packages:
[1] svSocket_0.9-51 lattice_0.19-26 MASS_7.3-22
loaded via a namespace (and not attached):
[1] cluster_1.14.3 Hmisc_3.10-1 R2HTML_2.2 svMisc_0.9-65
TinnR_1.0-5 tools_2.15.2
-- Bert
On Sun, Nov 18, 2012 at 8:09 AM, Ken Knoblauch
<ken.knobla...@inserm.fr> wrote:
Tom Roche <Tom_Roche <at> pobox.com> writes:
As described @
<<< clipped >>>
However I will need to before-and-after compare this to
the results of a
reboxing, or 3D regridding, of this data, so I would
prefer instead to
label each panel in the lattice with the _value_ of
the level (an
atmospheric pressure), rather than the name or
index of the level.
How to do that?
TIA, Tom Roche <Tom_Roche <at> pobox.com>
maybe, see ?strip.custom in lattice
--
Ken Knoblauch
Inserm U846
Stem-cell and Brain Research Institute
Department of Integrative Neurosciences
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.sbri.fr/members/kenneth-knoblauch.html
______________________________________________
R-help@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.
--
Bert Gunter
Genentech Nonclinical Biostatistics
Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
--
Ken Knoblauch
Inserm U846
Stem-cell and Brain Research Institute
Department of Integrative Neurosciences
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.sbri.fr/members/kenneth-knoblauch.html
______________________________________________
R-help@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.