Reputation: 671
I want to create a list in R that has 81 elements each of which is a length 1 vector with the value value NA
. I tried
list = list(rep(NA, 81))
But this create a list of 1 element of length 81. I also tried:
list = list(rep(list(NA),81))
But this returns a list of 81 elements which are nested lists not vectors. My desired output is something like this:
> list
[[1]]
[1] NA
[[2]]
[1] NA
[[3]]
[1] NA
.
.
.
[[81]]
[1] NA
Upvotes: 0
Views: 877