[R] combining data from multiple read.delim() invocations.

peter dalgaard pdalgd at gmail.com
Wed Jul 2 11:23:48 CEST 2014

On 01 Jul 2014, at 21:03 , John McKown <john.archie.mckown at gmail.com> wrote:

> Basically, a "wash". For a stress, I took in all 136 of my files in a
> single execution. Output was 22,823 elements in the data.frame.
> Yours:
> real    3m32.651s
> user    3m26.837s
> sys     0m2.292s
> Mine:
> real    3m24.603s
> user    3m20.225s
> sys     0m0.969s
> Still a wash. Of course, since I run this only once a week, on a Sunday,
> the time is not too important. I actually think that your solution is a bit
> more readable than mine. So long as I document what is going on.

One rbind() should actually be faster than using 136 rbind() calls while expanding the data frame on each iteration. Presumably, most of the time is spent elsewhere, but 8s in the opposite direction is a little surprising. You might want to check the timing  of just the

df.all <- do.call(rbind, df.list)


Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com

More information about the R-help mailing list