Re: [R] Help: convert entry of a list into a matrix

2011-08-24 Thread R. Michael Weylandt
Rereading your email, still not sure what the question is -- perhaps you could give a better code example to illustrate the difference between a[[2]] and mat1 -- but, since you mentioned briefly lists of lists, have you looked at unlist(, recursive = F)? If applied to a list of lists, it won't unli

Re: [R] Help: convert entry of a list into a matrix

2011-08-24 Thread R. Michael Weylandt
I'm not sure I understand your question: a[[2]] is a matrix. > a <- list(matrix(1:6,2),matrix(5:10,2)) > is.matrix(a[[2]]) TRUE x = a[[2]] > is.matrix(x) TRUE > x+2 [,1] [,2] [,3] [1,] 7 9 11 [2,] 810 12 > a[[2]] + 2 [,1] [,2] [,3] [1,] 7 9 11 [2,] 810 12 Wha

[R] Help: convert entry of a list into a matrix

2011-08-24 Thread Chee Chen
Dear All, As always, I appreciate all your help. I would like to know the easiest way to convert each of the homogeneous elements of a numeric list into a matrix. Each element of this list is also a list such that when displayed, looks like a 2-by-3 matrix , I would like to convert each of them