Skip to content
Prev 41913 / 63424 Next

How to deal with package conflicts

On 25/11/2011 9:10 AM, Terry Therneau wrote:
I think the general idea in formulas is that it is up to the user to 
define the meaning of functions used in them.  Normally the user has 
attached the package that is working on the formula, so the package 
author can provide useful things like s(), but if a user wanted to 
redefine s() to their own function, that should be possible.  Formulas 
do have environments attached, so both variables and functions should be 
looked up there.

This not perfectly applied, of course.  It is generally up to the 
function interpreting the formula to define what "+" means, for example.
You could also have the function treat s() and other functions 
specially, but this is likely to be a little risky.  (I'm in the process 
of putting together a small package for displaying tables; it treats +, 
*, and a few other function-like things specially:  Format, .Format, 
Heading and Justify.  I chose capital letters for those to hopefully 
avoid conflicts with a user's own functions.  Perhaps I should have used 
dots on all of them.)

Duncan Murdoch