title: How to sum values of array in each dimension into one matrix
body: <p>I've one array with three dimensions and want to sum up the values in each dimension and end up with one data matrix.</p>
  
  <p>Here is one example:</p>
  
  <pre><code>array1 &lt;- array(c(-5.5,6,3),dim = c(3,4,3))  
  
  matrix &lt;- matrix(NA, nrow=3, ncol=4)
  
  matrix
         [,1]   [,2]  [,3]   [,4]
  [1,]  -16.5  -16.5 -16.5  -16.5
  [2,]   18      18    18     18
  [3,]    9       9     9      9
  </code></pre>
  
  <p>Is it possible to do it somehow with a loop instead of using any apply function?</p>
  
  <p>Thanks in advance!</p>