Skip to content
Prev 106198 / 398506 Next

xyplot: discrete points + continuous curve per panel

Great. I will be trying to use panel.curve and pass a custom curve function
as first argument (called test() below). I can use which. packet to get
access to the panel number to produce the correct curve for each panel but
what I really need is the active Subj (actSubj) for each panel. Not sure but
it seems that Subj is passed on to the functions but in replicates. Here is
what I came up with to eliminate the replication and to calculate activeSubj
for each panel in test(). Is this the correct way? How can  I pass on Subj
and Dose directly to test()? Thanks, Rene

test <-function(x) {
    activeSubj <- unique(Subj)[which.packet()]
    x          # returns y=x for testing only
}
      
xyplot(Conc ~ Time | Subj,
       groups=Dose,
       data = mydata,
       as.table=T,
       panel = function(x,y) {
           panel.xyplot(x,y)
           panel.curve(test, n=2)
           }
       )
Deepayan Sarkar wrote: