[R] combining matrices from a list into a multidimensional array

Maas James Dr (MED) J.Maas at uea.ac.uk
Wed Jan 19 09:31:52 CET 2011


I get some results back from running an iterative analysis in the form of a list of matrices.  What I would like to do with this list is combine it such that all the similar components get combined into a multidimensional array.  If possible I'd like to put results[[1]]$resultmean and results[[2]]$resultmean into a 3x3x2 array, and also put results[[1]]$resultsd and results[[2]]$resultsd in a separate 3x3x2 array.  I'm sure this has been asked before, can someone point me in the right direction?

Thanks

J

> results
[[1]]
[[1]]$resultmean
         [,1]     [,2]      [,3]
[1,] 1.000000 0.768552 0.5743416
[2,] 1.307785 1.000000 0.7500699
[3,] 1.747145 1.340882 1.0000000

[[1]]$resultsd
           [,1]       [,2]       [,3]
[1,] 0.00000000 0.05495972 0.03390511
[2,] 0.09326529 0.00000000 0.05718047
[3,] 0.10250638 0.10124427 0.00000000


[[2]]
[[2]]$resultmean
         [,1]      [,2]      [,3]
[1,] 1.000000 0.8280938 0.6170682
[2,] 1.213807 1.0000000 0.7472884
[3,] 1.631536 1.3479570 1.0000000

[[2]]$resultsd
           [,1]       [,2]       [,3]
[1,] 0.00000000 0.05942645 0.05017175
[2,] 0.08719565 0.00000000 0.06344005
[3,] 0.13576301 0.11621178 0.00000000

===============================
Dr. Jim Maas
University of East Anglia



More information about the R-help mailing list