title: Stepwise reducing the input dataframe in a loop
body: <p>I need to do iteratively evaluate the variance of a dataset while i reduce the data.frame row by row in each step. As an example </p>
  
  <pre><code>data &lt;- matrix(runif(100),10,10)
  perc &lt;- list("vector")
  sums &lt;- sum(data)
  
  for (i in 1:nrow(data)) {      
    data &lt;- data[-1,]
    perc[[i]] &lt;- sum(data)/sums # in reality, here are ~8 additonal lines of code
  }
  </code></pre>
  
  <p>I dont like that <code>data</code> is re-initialized in every step, and that the loop breaks with an error, when <code>data</code> is emptied.
  So the questions are:
  1. How to express <code>data &lt;- data[-1,]</code> in an incrementing way (something like <code>tmp &lt;- data[-c(1:i),]</code>, which doesnt work?
  2. Is there a way to stop the loop, before the last row is removed from data?</p>