rbind and data.frame
On Fri, 7 Dec 2001, Prof Brian Ripley wrote:
On Fri, 7 Dec 2001, [iso-8859-1] G?ran Brostr?m wrote:
On Wed, 5 Dec 2001, G?ran Brostr?m wrote: [...]
My real problem is how to create a data frame in a sequentially growing manner, when I know the final size (no of cases). I want to avoid to call 'rbind' many times, and instead create an 'empty' data frame in one call, and then fill it. Are there better ways of doing this?
Got no answer to this one, so I provide one myself:
The usual answer is to create a data frame of the desired size and populate it via indexing. That's in some books I know!
I know that book too (thanks!). I did what you suggest, and that took 7 hours to run. Definitely. G?ran
The answer is: Yes, definitely. I did this, with pure R code, and created a new data frame with around 58000 records. It took 7 hours to run. I then did it with compiled code (Fortran), and that made a slight difference: It took 4.8 seconds(!). G?ran -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
G?ran Brostr?m tel: +46 90 786 5223 professor fax: +46 90 786 6614 Department of Statistics http://www.stat.umu.se/egna/gb/ Ume? University SE-90187 Ume?, Sweden e-mail: gb at stat.umu.se -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._