[R] detecting NULL in recursive lists

Vadim Ogranovich vogranovich at jumptrading.com
Mon Mar 9 19:18:53 CET 2009


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=list(x=NULL)), is.null)
    a
FALSE

Any suggestion?

Thank you for your help,
Vadim

Note: This email is for the confidential use of the named addressee(s) only and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you are hereby notified that any review, dissemination or copying of this email is strictly prohibited, and to please notify the sender immediately and destroy this email and any attachments.  Email transmission cannot be guaranteed to be secure or error-free.  Jump Trading, therefore, does not make any guarantees as to the completeness or accuracy of this email or any attachments.  This email is for informational purposes only and does not constitute a recommendation, offer, request or solicitation of any kind to buy, sell, subscribe, redeem or perform any type of transaction of a financial product.




More information about the R-help mailing list