Displaying 1 result from an estimated 1 matches for "345108".
Did you mean:
34.108
2009 Feb 22
2
Convert a list to matrix
I would like to convert a list to matrix. This can be easily achieved via
do.call. The only problem is each element of the list has different length,
which causes the recycling of values. How can I have NA instead of recycled
values ?
m <- list()
m[["A"]] <- 1
m[["B"]] <- 2:3
do.call(rbind, m)
[,1] [,2]
A 1 1
B 2 3
[[alternative HTML version deleted]]