On Jan 17, 2012, at 1:52 PM, Doran, Harold wrote:
It does indeed produce what I'm expecting. The input to panel.number
seems to require a character string, but here the function is called
with no argument. I am not entirely clear _why_ it works, but it
does seem to.
?panel.numer
Says that there is a default ... the last object printed, i.e, the one
for which you would want its number used as an idex into your vector
of candidate values.
--
David.
-----Original Message-----
From: David Winsemius [mailto:dwinsem...@comcast.net]
Sent: Tuesday, January 17, 2012 1:46 PM
To: Doran, Harold
Cc: Bert Gunter; r-help@r-project.org
Subject: Re: [R] Separate ablines in lattice panels
On Jan 17, 2012, at 1:34 PM, Doran, Harold wrote:
Thank you, Bert. The help page doesn't have a usage example and I
can't seem to find one via google. Do you, or anyone else, have
sample code?
It did not seem particularly daring or complex when I tried this
(which does appear to produce what was requested):
tmp <- data.frame(var1 = c(rnorm(1000), rnorm(1000, 1, 1)), var2 =
gl(2,
1000))
densityplot(~ var1|var2, tmp,
type = c('g', 'l'),
layout = c(1,2),
panel = function(x, ...){
panel.densityplot(x, ...)
panel.abline(v = c(0,1)
[ panel.number() ])
}
)
--
David.
-----Original Message-----
From: Bert Gunter [mailto:gunter.ber...@gene.com]
Sent: Tuesday, January 17, 2012 1:07 PM
To: Doran, Harold
Cc: r-help@r-project.org
Subject: Re: [R] Separate ablines in lattice panels
?panel.number
This tells you what panel you're in and you can use that to
determine
which line to draw.
-- Bert
On Tue, Jan 17, 2012 at 9:59 AM, Doran, Harold <hdo...@air.org>
wrote:
Searched archives and found some old email threads on the topic.
But mot
exactly what I think I need. Suppose I have a datafile such as tmp.
tmp <- data.frame(var1 = c(rnorm(1000), rnorm(1000, 1, 1)), var2 =
gl(2,
1000))
I'd like a plot similar to the one below, but with an abline of
v=0 in the
lower panel and v=1 in the upper panel. Code below creates two
lines in each
panel, not quite sure how to separate them by panel.
densityplot(~ var1|var2, tmp,
type = c('g', 'l'),
layout = c(1,2),
panel =
function(x, ...){
panel.densityplot(x, ...)
panel.abline(v =
c(0,1))
}
)
Thank you
Harold
[[alternative HTML version deleted]]
______________________________________________
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
______________________________________________
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.
David Winsemius, MD
West Hartford, CT
David Winsemius, MD
West Hartford, CT
______________________________________________
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.