From ripley at stats.ox.ac.uk  Sat Jul  3 19:30:35 2004
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sat Jul  3 19:30:44 2004
Subject: [Rd] Top-level code in packages
In-Reply-To: <40E6B9CE.5010606@vanderbilt.edu>
Message-ID: <Pine.LNX.4.44.0407031829080.1296-100000@gannet.stats>

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


[Rd] Top-level code in packages
Prof Brian Ripley