Message-ID: <Pine.LNX.4.44.0304142242110.14022-100000@gannet.stats>
Date: 2003-04-14T21:42:34Z
From: Brian Ripley
Subject: removing NULL elements from a list
In-Reply-To: <AFD78192EC49D311BFAE00902798AB8F23DD8D@jupiter.arbitrade.com>
On Mon, 14 Apr 2003, Vadim Ogranovich wrote:
> you can also modify the original list "in place":
>
> l[sapply(l, is.null)] <- NULL
>
>
> I don't understand why it works this way especially given that, for example,
>
> l[sapply(l, is.null)] <- 5
>
> simply replaces NULL elements of the list with 5. This probably has to do
> with the special semantics of NULL. I'd appreciate if someone could clearify
> this for me.
It's in the FAQ.
--
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