[Rd] Top-level code in packages
Prof Brian Ripley
ripley at stats.ox.ac.uk
Sat Jul 3 19:30:35 CEST 2004
On Sat, 3 Jul 2004, Frank E Harrell Jr wrote:
[...]
> I use that sort of construct a lot, except that tools::: can't be used
> in general for backwards compatibility and for compatibility with
> S-Plus. But often I use the following construct and would like to keep
> doing so, especially when defining functions for compatibility when the
> function only needs defining for a subset of the supported systems:
>
> if(.R. || .SV4.) { # variables defined in Hmisc or Design package
> foo <- function( . . . ) {
> }
> NULL # prevents printing a result in S-Plus
> }
That's fine, as its effect is a top-level assignment and nothing else
useful (the NULL will be pointless, but who cares).
--
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