title: Initializing and Appending to a data.frame in R
body: <p>I'm trying to initialize a data.frame with 2 columns and 40 rows to which I'll go on adding rows. This is the code that I have - </p>
  
  <pre><code>result.frame = as.data.frame(matrix(ncol=2, nrow=10))
  names(result.frame) = c("ID", "Value")
  for (i in 1:10) {
      value = somefunction(i)
      rbind(result.frame, c(i, value))
  }
  </code></pre>
  
  <p>When I run this, I'm just getting a data.frame containing NA. Also, I read on SO that dynamically growing structures is one of the least efficient ways to code in R. If this is true, what is the right way to accomplish something like this?</p>
  
  <p>Thanks a lot!</p>