title: R three dimensional arrays
body: <p>I have an 3D array - arr</p>
  
  <pre><code>dim(arr)
  [1] 2000   22    3
  </code></pre>
  
  <p>Let's call 2000 <code>dim1</code>, 22 <code>dim2</code>, and 3 <code>dim3</code>.
  I would like to do something like this:</p>
  
  <pre><code>for(d1 in 1:dim1){
      for(d2 in 1:dim2){
          #compute the mean across the 2000 values of arr[d1,d2]
          m&lt;-mean(arr[d1,d2])
      }
  }
  </code></pre>
  
  <p>Any idea?</p>