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