[R] detecting NULL in recursive lists
vogranovich at jumptrading.com
Mon Mar 9 19:18:53 CET 2009
How can I detect a NULL in a recursive list?
For a regular list I could use lapply:
> lapply(list(x=NULL), is.null)
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)
Thank you for your help,
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