[R] List elements of NULL to value

LCOG1 jroll at lcog.org
Mon Nov 29 21:50:59 CET 2010


Hi everyone, 
    I am posting this because i know its easy and i cant for the life of me
figure out how to do it though i have tried and through a ridiculously
complex loop made it happen.  I need to convert some list elements of NULL
value to 0s so they mesh with my data frame properly.  So for 

A<-list(1,NULL)

returns

[[1]]
[1] 1

[[2]]
NULL

Would instead return

[[1]]
[1] 1

[[2]]
[1] 0

The nabble posts seem to indicate dealing with NULLs can be tricky so i am
attributing my lack of success to that, mainly so i can live with myself and
asking the list such a simple question.  Sorry again guys.

JR
-- 
View this message in context: http://r.789695.n4.nabble.com/List-elements-of-NULL-to-value-tp3064384p3064384.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list