[Rd] function local to a fit

From: Terry Therneau <therneau_at_mayo.edu>
Date: Tue, 08 Mar 2011 07:39:56 -0600

  I've added a time-transform ability to coxph: here is an example

fit <- coxph(Surv(time, status) ~ age + tt(age) + sex, data=lung,

        tt=function(x, t, ...) x*log(t) )

The only role for tt() in the formula is to be noticed as a specials by terms(). I currently have tt defined as a function

        tt <- function(x)
It has to be exported in the namespace, documented, etc.

Is there a way to make tt() local to coxph, but still be found by model.frame, so that it does not have to be global? It would seem to be neater to do a marker transform like s() in gam, cluster() in coxph, etc in this way, where the meaning is local to the enclosing function.

Terry Therneau

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 08 Mar 2011 - 14:13:18 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 Mar 2011 - 15:00:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive