title: How to obtain the mean-matrix from a list of matrices in R
body: <p>I have a list of 100 50*50 matrices in R stored in a variable called all_permutations.</p>
  
  <pre><code>&gt; str(all_permutations)
  List of 100
   $ : num [1:50, 1:50] 0 0.00972 0.34989 0 0.0019 ...
    ..- attr(*, "dimnames")=List of 2
    .. ..$ : chr [1:50] "G1" "G2" "G3" "G4" ...
    .. ..$ : chr [1:50] "G1" "G2" "G3" "G4" ...
   $ : num [1:50, 1:50] 0 0.00972 0.34989 0 0.0019 ...
    ..- attr(*, "dimnames")=List of 2
    .. ..$ : chr [1:50] "G1" "G2" "G3" "G4" ...
    .. ..$ : chr [1:50] "G1" "G2" "G3" "G4" ...
  </code></pre>
  
  <p>Is there an elegant way to obtain the mean of all these matrices without constructing double for-loops to get the average for each index across all 100 matrices? Thank you.</p>