title: take the mean of rows in a matrix r
body: <p>I have the following matrix of depth and temperature data (855 rows, 2 col) and would like to take the mean of every 3 rows within each column. For example:</p>
  
  <pre><code> [1,]  -6.7 18.91
   [2,]  -5.4 18.91
   [3,]  -4.0 18.59
   [4,]  -6.7 20.37
   [5,]  -6.7 20.05
   [6,]  -2.7 20.21
   [7,]  -4.0 21.03
   [8,]  -5.4 20.70
   [9,]  -4.0 20.87
  [10,]  -2.7 21.37
  [11,]  -2.7 21.37
  [12,]  -2.7 21.37
  
  mean(data[1:3,1])
  mean(data[4:6,1])
  </code></pre>
  
  <p>for the entire matrix. How can I accomplish this without manually writing the code for the mean of every 3 rows? Any ideas or suggestions are greatly appreciated.</p>