title: Standard deviation over a list of matrices in R
body: <p>I have a list in which each element is a matrix. </p>
  
  <pre><code>set.seed(123)
  
  m1 &lt;- matrix(sample(c(1:10), size = 9, replace = TRUE), ncol = 3, nrow = 3)
  m2 &lt;- matrix(sample(c(1:10), size = 9, replace = TRUE), ncol = 3, nrow = 3)
  m3 &lt;- matrix(sample(c(1:10), size = 9, replace = TRUE), ncol = 3, nrow = 3)
  
  m &lt;- list(m1, m2, m3)
  m
  [[1]]
        [,1] [,2] [,3]
  [1,]    3    9    6
  [2,]    8   10    9
  [3,]    5    1    6
  
  [[2]]
       [,1] [,2] [,3]
  [1,]    5    7    9
  [2,]   10    6    3
  [3,]    5    2    1
  
  [[3]]
       [,1] [,2] [,3]
  [1,]    4    7    7
  [2,]   10    7    8
  [3,]    9   10    6
  </code></pre>
  
  <p>I want to calculate the standard deviation of <strong><em>each pair</em></strong> considering all three matrices. So for cell [1,1] the standard deviation would be:</p>
  
  <pre><code>sd(c(3, 5, 4))
  </code></pre>
  
  <p>My final matrix should look like this:</p>
  
  <pre><code>     [,1] [,2] [,3]
  [1,] 1.00 1.15 1.53
  [2,] 1.15 2.08 3.21
  [3,] 2.31 4.93 2.89
  </code></pre>
  
  <p>How can I achieve this in R without a loop over all three matrices?</p>
  
  <p>Many thanks in advance.</p>