title: dynamically expand a data frame columns using cbind
body: <p>I would like to build a data frame in a loop adding a new column each time using <code>cbind</code>.  I try the following:</p>
  
  <pre><code>test &lt;- NULL
  df &lt;- data.frame(x=c(1,2,3,4))
  test &lt;- cbind(test, df)
  </code></pre>
  
  <p>This generates an error:</p>
  
  <pre><code>Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 0, 4
  </code></pre>
  
  <p>What is the correct way to instantiate a blank data frame in R and then bind to it in a loop?</p>
  
  <p>Thanks</p>