From weston at lindaspaces.com  Tue Feb 12 16:00:54 2008
From: weston at lindaspaces.com (Stephen B. Weston)
Date: Tue, 12 Feb 2008 10:00:54 -0500
Subject: [Rd] assigning NULLs to elements of a list
In-Reply-To: <47B17DD3.1080100@ebi.ac.uk>
References: <47B17DD3.1080100@ebi.ac.uk>
Message-ID: <47B1B4A6.8010108@lindaspaces.com>

Oleg Sklyar wrote:
> Dear developers:
> 
> I have just came across an (unexpected to me) behaviour of lists when 
> assigning NULLs to list elements. I understand that a NULL is a valid R 
> object, thus assigning a NULL to a list element should yield exactly the 
> same result as assigning any other object. So I was surprised when 
> assigning a NULL in fact removed the element from the list. Is this an 
> intended behaviour? If so, does anybody know where is it documented and 
> what is a good way around?

This topic is discussed in the R FAQ, in section 7.1 "How can I set 
components of a list to NULL?"  It also shows up in section 3.3.3,
in the context of incompatibilities with S.

- Steve



[Rd] assigning NULLs to elements of a list
Stephen B. Weston