Re: [R] detecting NULL in recursive lists

2009-03-09 Thread Charles C. Berry
On Mon, 9 Mar 2009, Vadim Ogranovich wrote: Dear R-users, How can I detect a NULL in a recursive list? For a regular list I could use lapply: lapply(list(x=NULL), is.null) $x [1] TRUE However that doesn't work for structures like list(list(x=NULL)). I tried rapply but it treats NULL as a

[R] detecting NULL in recursive lists

2009-03-09 Thread Vadim Ogranovich
Dear R-users, How can I detect a NULL in a recursive list? For a regular list I could use lapply: > lapply(list(x=NULL), is.null) $x [1] TRUE However that doesn't work for structures like list(list(x=NULL)). I tried rapply but it treats NULL as a list and discards them: > rapply(list(a=1, b=