removing NULL elements from a list
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