From ripley at stats.ox.ac.uk  Mon Feb 28 23:28:34 2005
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon Feb 28 23:28:47 2005
Subject: [Rd] Changing function arguments to NULL
In-Reply-To: <67DCA285A2D7754280D3B8E88EB5480206741E85@MSGBOSCLB2WIN.DMN1.FMR.COM>
References: <67DCA285A2D7754280D3B8E88EB5480206741E85@MSGBOSCLB2WIN.DMN1.FMR.COM>
Message-ID: <Pine.LNX.4.61.0502282217450.960@gannet.stats>

On Mon, 28 Feb 2005, McGehee, Robert wrote:

> But passing list(NULL) or NULL into a function may have entirely
> different results.

For a replacement operator expecting a list, list(NULL) *is* what you 
want.  BTW, this is FAQ 7.1.

> foo <- alist(x = 5, y = 2, z = 3)
> foo["x"] <- list(NULL)
> foo
$x
NULL

$y
[1] 2

$z
[1] 3

if (as I guess) you want to set the default value to NULL, not `the 
argument to NULL'.

[...]

-- 
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] Changing function arguments to NULL
Prof Brian Ripley