[Rd] package NAMESPACE question

Therneau, Terry M., Ph.D. therneau at mayo.edu
Wed Jan 29 17:52:09 CET 2014

For the special tt mark in a formula, the answer is "mine".  Other than that coxph handles 
formulas in a completely standard way.

I don't see any other solution, frankly, unless I want to get really complex.  If formulas 
were not handled in an odd way, I'd simply add tt() to my namespace, not export it, and 
coxph would get my function by preference.  I had to engage in a little more trickery to 
get this behavior, but that is somewhat beside the point.

The key issue is actually the same one addressed by namespaces: when my function sees tt() 
in a formula, how does it decide whether to use its own function ("tt" is special, and 
documented as so), or believe that some other version is avaialable and should be used? 
If there is a tt() in the working directory?  In an attached library()?  In a directory on 
the search list (but ignore libraries)?  An attached "esp" library that reads the user's 

Terry T.

On 01/29/2014 09:48 AM, Duncan Murdoch wrote:
> I'm not familiar with how coxph handles formulas.  Can a user put f(x) into a formula,
> where f is a user-defined function?  If a user defines a tt function, will coxph use
> theirs, or yours?
> I'd say the answers for situations like this should be "yes" and "theirs", but that's not
> true of my tables package, where answers to the corresponding questions would be "yes" and
> "mine".

More information about the R-devel mailing list