[R] xyplot: getting data into the panel function

Deepayan Sarkar deepayan.sarkar at gmail.com
Tue Apr 4 21:33:34 CEST 2006


On 4/4/06, Søren Højsgaard <Soren.Hojsgaard at agrsci.dk> wrote:
> In xyplot, I would like to get the "data into the panel function" in the
> following sense: Consider
>
> xyplot(scc~time|cowidp, data=cow.s,type=c("l"),
>   panel=function(x,y,subscripts,...){
>     panel.xyplot(x,y,...)
>     vvv<-cow.s[which(!is.na(cow.s[subscripts,"mastreat"])),"time"]
>     panel.abline(v=vvv,col="red",lwd=2)
>   }
> )

It's hard to be sure without an example, but how is this any different from

xyplot(scc~time|cowidp, data=cow.s, type=c("l"),
       panel=function(x, y, ...) {
           panel.xyplot(x,y,...)
           panel.abline(v = x, col="red",lwd=2)
       })

?

-Deepayan




More information about the R-help mailing list