title: writing to a dataframe from a for-loop in R
body: <p>I'm trying to write from a loop to a data frame in R, for example a loop like this></p>
  
  <pre><code>for (i in 1:20) {
  print(c(i+i,i*i,i/1))}
  </code></pre>
  
  <p>and to write each line of 3 values to a data frame with three columns, so that each iteration takes on a new row. I've tried using matrix, with ncol=3 and filled by rows, but only get the last item from the loop.</p>
  
  <p>Thanks.</p>