title: Mean on the third dimension in R
body: <p>Is there any quick way or build-in function in R to calculation the mean values based on the third dimension?</p>
  
  <p>For example my array is:</p>
  
  <pre><code>, , 1
       [,1] [,2]
  [1,]    1    3
  [2,]    2    4
  
  , , 2
      [,1] [,2]
  [1,]   11   13
  [2,]   12   14
  
  , , 3
       [,1] [,2]
  [1,]   21   23
  [2,]   22   24
  </code></pre>
  
  <p>My output would be:</p>
  
  <pre><code>            [,1]        [,2]
  [1,]   mean(1,11,21)   mean(3,13,23)
  [2,]   mean(2,12,22)   mean(4,14,24)
  </code></pre>
  
  <p>Thanks!</p>