Hi Ken,
If your lists are not too large something such as this can work:
> matrixFromList <- function(listX) t(sapply(listX, function(x, n) c(x, rep(NA,
> n))[1:n], n = max(sapply(listX, length
> matrixFromList(list(c(3,2,3),c(6,5)))
[,1] [,2] [,3]
[1,]323
[2,]65
on 01/14/2009 03:50 PM Lo, Ken wrote:
> 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?
>
>
2 matches
Mail list logo