[Rd] Reorganization of packages in the R distribution
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Dec 18 09:01:40 MET 2003
The short answer is no: there is no supported way to override an R system
function. The only reason we can see to do that is to correct a bug, and
we would prefer to get the buggy original changed ASAP.
It is much preferable for package authors to name variant versions
differently: if any 1 is allowed to masquerade, then N > 1 can do so too
and their versions will conflict.
However, if you wish to engage in this activity, the way you do it is
almost as good as any. In these days of namespaces, something like
lowess.default <- stats::lowess
is needed, so
lowess.default <-
if(R.version$major == 1 && R.version$minor < 9) base::lowess
else stats::lowess
looks about right (since I suspect your code is not intended for R <
1.6.0).
Nevertheless, be aware that there is no guarantee that users will get your
version because of the namespace scoping rules.
On Tue, 16 Dec 2003, Warnes, Gregory R wrote:
>
> Ok, to take this thread in a slightly different direction. In my 'gregmisc'
> package I redefine the R code 'lowess' function
> by moving the existing 'lowess' to 'lowess.default' and making 'lowess' a
> generic.
>
> Is there a "proper" and "supported" way of accomplishing this task?
>
> [Please ignore for the moment whether this is appropriate for the lowess
> function. That is a separate discussion.]
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list