[R] coercing a list into matrix

Lo, Ken ken.lo at roche.com
Wed Jan 14 22:50:57 CET 2009


Dear list,

I have a list of number sequences.  Each number sequence has different
numbers of elements.  Is there a quick way (other than to iterate
through the entire list) way to coerce list to matrix with NAs filling
in the short sequences?

An example of what I mean is this:

A <- list(c(3,2,3),c(6,5))

I'd like to get A so that it is

3 2 3
6 5 NA


Best,

Ken




More information about the R-help mailing list