Hi
xyplot(y ~ x | subject) plots a separate graph of y against x for each
level of subject. But I would like to have an own function for each
level. Something like
xyplot(y ~ x | subject,
panel = function(x,y) {
panel.xyplot(x,y)
panel.curve(x,y) {
# something that dependents on the current subject
...
}
})
How I get the current subject? (The current subject is the title of the
graph, too)
thx
Christof
lattice xyplot, get current level
4 messages · Christof Kluß, Bert Gunter, David Winsemius
subj <- levels(subject) subj[panel.number()] seems to be a good solution is there something like panel.legend (instead of panel.text)? Am 02-10-2012 12:59, schrieb Christof Klu?:
Hi
xyplot(y ~ x | subject) plots a separate graph of y against x for each
level of subject. But I would like to have an own function for each
level. Something like
xyplot(y ~ x | subject,
panel = function(x,y) {
panel.xyplot(x,y)
panel.curve(x,y) {
# something that dependents on the current subject
...
}
})
How I get the current subject? (The current subject is the title of the
graph, too)
thx
Christof
Christof: You are aware, I assume, that the subject level name can be incorporated into the strip label via the "strip" function argument; e.g. xyplot(..., strip = strip.custom(style = 1, strip.levels=c(TRUE,TRUE)), ...) Cheers, Bert
On Tue, Oct 2, 2012 at 6:45 AM, Christof Klu? <ckluss at email.uni-kiel.de> wrote:
subj <- levels(subject) subj[panel.number()] seems to be a good solution is there something like panel.legend (instead of panel.text)? Am 02-10-2012 12:59, schrieb Christof Klu?:
Hi
xyplot(y ~ x | subject) plots a separate graph of y against x for each
level of subject. But I would like to have an own function for each
level. Something like
xyplot(y ~ x | subject,
panel = function(x,y) {
panel.xyplot(x,y)
panel.curve(x,y) {
# something that dependents on the current subject
...
}
})
How I get the current subject? (The current subject is the title of the
graph, too)
thx
Christof
______________________________________________ R-help at 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
On Oct 2, 2012, at 3:59 AM, Christof Klu? wrote:
Hi
xyplot(y ~ x | subject) plots a separate graph of y against x for each
level of subject. But I would like to have an own function for each
level. Something like
xyplot(y ~ x | subject,
panel = function(x,y) {
panel.xyplot(x,y)
panel.curve(x,y) {
# something that dependents on the current subject
...
}
})
This seems to be different question than what you later requested. This question would seem to be documented in the 'panel' section of help(xyplot) in particular the paragraph beginning with this sentence: "One can also use functions called panel.number and packet.number, representing panel order and packet order respectively, inside the panel function (as well as the strip function or while interacting with a lattice display using trellis.focus etc). "
David Winsemius, MD Alameda, CA, USA