[R] Passing arguments to panels in trellis plots

Marco Chiarandini marco at imada.sdu.dk
Wed Dec 13 12:57:37 CET 2006


Dear all,

I am trying to produce survfit plots in a trellis environment and I
would like the plots to be logarithmic.

I am trying this:

print(Ecdf(~time | size*type, groups=alg,data=B,subscripts=TRUE,
            panel=function(x,groups,subscripts)
            {
              t <- survfit(Surv(time[subscripts],event[subscripts])~groups[subscripts],data=B)
              panel.xyplot(t[1]$time,1-t[1]$ssurv,type="s",lty=2)
              panel.xyplot(t[2]$time,1-t[2]$ssurv,type="s",lty=2)
            },
 	   scale=list(log=TRUE)
)



but data are transformed in logarithm before being passed to the panel
and hence the output of the function survfit is not the expected one.

Is there a way to plot this correctly, ie, having first the survfit
computed and then the plot, like in:

plot(survfit(Surv(time,event)~groups,data=B),log=true)

Thanks in advance.

- Marco.


--
Marco Chiarandini                     http://www.imada.sdu.dk/~marco
Department of Mathematics	      Email: marco AT imada.sdu.dk
and Computer Science,		      Phone: +45 6550 4031
University of Southern Denmark        Fax: +45 6593 2691



More information about the R-help mailing list