Re: [Rd] Top-level code in packages

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Sun 04 Jul 2004 - 03:30:35 EST


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@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

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
Received on Sun Jul 04 03:33:45 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:45:01 EST