[R] Filling empty List in a FOR LOOP
Rui Barradas
rui1174 at sapo.pt
Mon Apr 2 01:18:01 CEST 2012
Hello,
michaelyb wrote
>
> Ok. I appreciate your help. i don't understand what you guys mean by
> "reproducible example", if you explained better, I will be more than glad
> to post it.
>
> Regards,
>
Try this:
R> A <- list(a=NULL, b=NULL)
R> A
R> dput(A)
Now, the output of 'dput' is a reproducible data example, just
copy/paste/assign with '<-'
R> X <- structure(list(a = NULL, b = NULL), .Names = c("a", "b"))
And test the suggestions above. (Just the first.)
R> lapply(X, function(ll) ifelse(is.null(ll),NA,ll)) # works
Use 'dput' and copy&paste it's output here, in your post, for us to have an
exact example of your data.
Clear enough?
Rui Barradas.
--
View this message in context: http://r.789695.n4.nabble.com/Filling-empty-List-in-a-FOR-LOOP-tp4522694p4524695.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list