Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Out of Memory Error (Java)" when using R and XLConnect package

Tags:

memory

r

excel

I tried to load a ~30MB excel spreadsheet into R using the XLConnect package.

This is what I wrote:

wb <- loadWorkbook("largespreadsheet.xlsx") 

And after about 15 seconds, I got the following error:

Error: OutOfMemoryError (Java): GC overhead limit exceeded.

Is this a limitation of the XLConnect package or is there a way to tweak my memory settings to allow for larger files?

I appreciate any solutions/tips/advice.

like image 501
AME Avatar asked Nov 01 '11 07:11

AME


2 Answers

Follow the advice from their website:

options(java.parameters = "-Xmx1024m") library(XLConnect) 
like image 72
Henrico Avatar answered Oct 13 '22 19:10

Henrico


If you still have problems with importing XLSX files you can use this opiton. Anwser with "Xmx1024m" didn't work and i changed to "-Xmx4g".

options(java.parameters = "-Xmx4g" ) library(XLConnect) 

This link was useful.

like image 28
Maciej Avatar answered Oct 13 '22 20:10

Maciej