title: Sum every nth points
body: <p>I have a vector and I need to sum every <code>n</code> numbers and return the results. This is the way I plan on doing it currently. Any better way to do this?</p>
  
  <pre><code>v = 1:100
  n = 10
  sidx = seq.int(from=1, to=length(v), by=n)
  eidx = c((sidx-1)[2:length(sidx)], length(v))
  thesum = sapply(1:length(sidx), function(i) sum(v[sidx[i]:eidx[i]]))
  </code></pre>
  
  <p>This gives:</p>
  
  <pre><code>thesum
   [1]  55 155 255 355 455 555 655 755 855 955
  </code></pre>