title: R: Average by every N value in 3-dim matrix
body: <p>I have a matrix A with hourly data (on a monthly period) and dim [116 152 744]
  I am trying to create matrix B with daily data and dim [116 152 31] 
  Obviously where every dim TSTEP in B is the average of the first 24 TSTEPS in matrix A. </p>
  
  <p>I was successful in creating a matrix C with monthly data with a simple apply </p>
  
  <pre><code>C &lt;- apply(A, c(1,2), function (x) mean(x))
  </code></pre>
  
  <p>But can't quite figure it out to average over every N values. Thanks. </p>