I am using the following R code (that utilizes the Java parameter to increase memory as well):
library(xlsx)
options(java.parameters = "-Xmx1g")
library(XLConnect)
NiVe <- read.xlsx("version1.xlsx",1)
The version1.xlsx
file is 13 MB in size. I get the following error:
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
java.lang.OutOfMemoryError: Java heap space
Can someone help?
You should make sure that you are setting the Java parameters before any JVM is initialized, i.e. before either the XLConnect or xlsx packages are loaded. Note that in your case you are using the read.xlsx function which is not an XLConnect function and therefore the XLConnect package is not required. The XLConnect alternative is the function readWorksheetFromFile.
Try to increase java Heap size(sufficient), by using:
this thread may help you, to use Garbage Collection.
Reference:
exchanging_data_between_r_and_ms_windows_apps_excel_etc
stats-rosuda-devel_001621
Try this :- May be this can work. It worked for me
1) when downloading the xlsx file, use this download.file(fileURL, destfile="./whatever", mode="wb")
2) Switched to regular R, not R Studio,