Creating an R dataframe row-by-row
You can grow them row by row by appending or using rbind(). That does not mean you should. Dynamically growing structures is one of the least efficient ways to code in R. If you can, allocate your entire data.frame up front: N <- 1e4 # total number of rows to preallocate–possibly an overestimate DF <- … Read more