[Rd] function local to a fit

Terry Therneau therneau at mayo.edu
Tue Mar 8 14:39:56 CET 2011

  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

More information about the R-devel mailing list