[R] Drawing a line in xyplot
ilai
keren at math.montana.edu
Sat Apr 7 20:47:25 CEST 2012
On Sat, Apr 7, 2012 at 11:16 AM, David Winsemius <dwinsemius at comcast.net> wrote:
> xyplot(mortality ~ type, data=xdat,
> panel=function(x,y){
> panel.xyplot(x,y, jitter.x=TRUE)
> panel.segments(x0=c(.9, 1.9, 2.9),
> x1=c(1.1,2.1,3.1),
> y0=tapply(xdat$mortality, xdat$type,
> median),
> y1=tapply(xdat$mortality, xdat$type,
> median),
> col="red", lwd=3 )
>
> })
>
Actually the OP had formula = mortality ~ factor(attend)|type,
(two conditioning factors). This approach will work but will require
1) replace type with attend in tapply
2) subset conditional on packet.number
3) loop over the segments for the two sets of x-coords
An alternative will be
bwplot(mortality ~ factor(attend)|type,data=xdat,
pch=95,cex=5,col=2,
par.settings=list(
box.rectangle = list(col = 'transparent'),
box.umbrella = list(col = 'transparent')
),
panel=function(x,y,...){
panel.grid(lty=5)
panel.bwplot(x,y,...)
panel.xyplot(x,y,pch=16,jitter.x=TRUE,col=1)
}
)
Hope this helps
>
>> thanks
>>
>>
>>
>> --
>> View this message in context:
>> http://r.789695.n4.nabble.com/Drawing-a-line-in-xyplot-tp4538689p4539596.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> 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.
>
>
> David Winsemius, MD
> West Hartford, CT
>
>
> ______________________________________________
> 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.
More information about the R-help
mailing list