Skip to content

removing NULL elements from a list

2 messages · Vadim Ogranovich, Brian Ripley

#
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.

Thanks,
Vadim
-------------------------------------------------- 
DISCLAIMER\ This e-mail, and any attachments thereto, is intende... {{dropped}}
#
On Mon, 14 Apr 2003, Vadim Ogranovich wrote:

            
It's in the FAQ.