Skip to content
Prev 366491 / 398502 Next

About populating a dataframe in a loop

As a rule never rbind in a loop. It has O(n^2) run time because the rbind
itself can be O(n) (where n is the number of data.frames).  Instead either
put them all into a list with lapply or vector("list", length=) and then
datatable::rbindlist, do.call(rbind, thelist) or use the equivalent from
dplyr.  All of which will be much more efficient.
On Fri, Jan 6, 2017 at 8:46 PM, lily li <chocold12 at gmail.com> wrote: