title: How to sum grouped elements of a vector in R
body: <p>Let's say I have this vector </p>
  
  <pre><code>v &lt;- c(1:100) 
  </code></pre>
  
  <p>And I want to get this:</p>
  
  <pre><code>b[1] = sum (v[c(1:10)])
  b[2] = sum (v[c(11:20)])
  ...
  ...
  </code></pre>
  
  <p>I can do a loop to solve this, but I am pretty sure there is a "R way" that should be something like:</p>
  
  <pre><code>b &lt;- groupedSum(v, 10) 
  </code></pre>
  
  <p>where b will be a vector which will have each group of 10 summed 
  What is the R way?</p>