I am trying to import a 128M .xlsx file into R, and am having no end of trouble.
Here is the code I am using:
memory.limit(size = 32292)
setwd("C:\\Users\\Administrator\\Desktop\\R Programming")
getwd()
install.packages("rJava")
library(rJava)
options(java.parameters = "-Xmx4g" )
install.packages("xlsx")
library(xlsx)
datafile <- read.xlsx("big honking datafile.xlsx", 1)
And here are the results:
> memory.limit(size = 32292)
[1] 32292
> setwd("C:\\Users\\Administrator\\Desktop\\R Programming")
> getwd()
[1] "C:/Users/Administrator/Desktop/R Programming"
> install.packages("rJava")
trying URL 'http://mran.revolutionanalytics.com/snapshot/2014-10 01/bin/windows/contrib/3.1/rJava_0.9-6.zip'
Content type 'application/zip' length 759547 bytes (741 Kb)
opened URL
downloaded 741 Kb
package ‘rJava’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Administrator\AppData\Local\Temp\2\Rtmpuacxly\downloaded_packages
> library(rJava)
> #options(java.parameters = "-Xmx1000m")
> options(java.parameters = "-Xmx4g" )
> install.packages("xlsx")
trying URL 'http://mran.revolutionanalytics.com/snapshot/2014-10 01/bin/windows/contrib/3.1/xlsx_0.5.7.zip'
Content type 'application/zip' length 400740 bytes (391 Kb)
opened URL
downloaded 391 Kb
package ‘xlsx’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Administrator\AppData\Local\Temp\2\Rtmpuacxly\downloaded_packages
> library(xlsx)
Loading required package: xlsxjars
> datafile <- read.xlsx("big honking datafile.xlsx", 1) # read first sheet
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
java.lang.OutOfMemoryError: Java heap space
I know this is a large file, but I've used larger .csv files before. In fact, when this file is externally converted to .csv, I have no issues.
Anyone have any suggestions (aside from always working in .csv, and never having to convert)?
Thanks!