I have list of lists (same lengths: n). How can I concatenate them, to get one vector of the same input length (n) ? For example I have:
[[1]]
[1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[[2]]
[1] "a" "a" NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[[3]]
[1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA "d" "e" NA NA NA
I want to get:
"a" "a" NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA "d" "e" NA NA NA
I have tried:
Reduce('union',lapply(l,function(x){x$AB}))
But I got:
"a" NA "d" "e"
I want to get a vector with same length as the input l[[1]]$AB
. Any ideas?