I have two data-frames df1
and df2
that each have around 10 million rows and 4 columns. I read them into R using RODBC/sqlQuery with no problems, but when I try to rbind
them, I get that most dreaded of R error messages: cannot allocate memory
. There have got to be more efficient ways to do an rbind
more efficiently -- anyone have their favorite tricks on this they want to share? For instance I found this example in the doc for sqldf
:
# rbind
a7r <- rbind(a5r, a6r)
a7s <- sqldf("select * from a5s union all select * from a6s")
Is that the best/recommended way to do it?
UPDATE
I got it to work using the crucial dbname = tempfile()
argument in the sqldf
call above, as JD Long suggests in his answer to this question
memory.limit(size = 4000)
? – Keslerwrite.csv
and combine the data using the shell. See #2477771 – Castilesqldf
-based versions of functions likerbind
sounds like a fun homework challenge for someone. – Onanism