From therneau at mayo.edu  Wed Jan 29 17:52:09 2014
From: therneau at mayo.edu (Therneau, Terry M., Ph.D.)
Date: Wed, 29 Jan 2014 10:52:09 -0600
Subject: [Rd] package NAMESPACE question
In-Reply-To: <52E922BF.1050805@gmail.com>
References: <mailman.19.1390993211.1898.r-devel@r-project.org>
	<d2fb82$886lse@ironport10.mayo.edu> <52E922BF.1050805@gmail.com>
Message-ID: <d2fb82$888dq7@ironport10.mayo.edu>

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 
mind?

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".



[Rd] package NAMESPACE question
Therneau, Terry M., Ph.D.