[R] rbind() very slow... Oops sorry!

Philippe Grosjean phgrosje at ulb.ac.be
Wed Apr 17 18:38:26 CEST 2002


Indeed, for some reasons during pretreatment of my data, I ended up with
15x39 variables in each table (15 copies of each!!), meaning I was trying to
create a 585 x 3500 table with rbind(), i.e., about 2 millions of entries.
So, memory requirements and time are not surprising in this case. Sorry for
this.

Best,

Philippe Grosjean

-----Message d'origine-----
De : owner-r-help at stat.math.ethz.ch
[mailto:owner-r-help at stat.math.ethz.ch]De la part de Peter Dalgaard BSA
Envoye : mercredi 17 avril 2002 16:34
A : Philippe Grosjean
Cc : r-help at stat.math.ethz.ch
Objet : Re: [R] rbind() very slow


"Philippe Grosjean" <phgrosje at ulb.ac.be> writes:

> Hi,
>
> I have 16 tables of 39 variables with around 1500 to 3500 cases in each
> table. These 16 tables are in 16 different data frames. I want to merge
them
> in a single large data frame, so:
>
> All <- rbind(T1, T2, ...)
>
> The problem: it is VERY slow, and takes a lot of memory (> 500 Mb) on my
> Athlon XP1800+, 1.75 Go memory, Win 2000 Pro SP1, R 1.4.1. Any suggestion
to
> improve speed, and/or memory use?
> Thanx,

No fix, but could you try running the profiler over this? I.e.

Rprof()
All <- rbind(T1, T2, ...)
Rprof(NULL)

and then on the command line

Rcmd Rprof Rprof.out

If this proves awkward on Windows, could you cook up an example (e.g.
with random data) that reproduces the effect?

--
   O__  ---- Peter Dalgaard             Blegdamsvej 3
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list