I'm having a strange problem with loading the xlsx package and using choose.files.
This problem began as soon as I updated RStudio to the newest version (v0.97.237). If I start RStudio and then load xlsx (i.e. library(xlsx)
) the package loads just fine. However, if I then try and use choose.files()
, RStudio freezes up (actually it continually runs and can't be closed without ending it with Win7 task manager). If I start RStudio and use choose.files first, it works just fine. If I then run the library(xlsx)
line, the xlsx package won't load. It gives the error below.
I've tried reinstalling the xlsx package (along with xlsxjars and rJava), but that didn't work. Neither did reinstalling Java.
Any suggestions? I'm using R v2.15.2.
library(xlsx)
Loading required package: xlsxjars
Loading required package: rJava
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error : .onLoad failed in loadNamespace() for 'xlsxjars', details:
call: .jinit()
error: Cannot create Java virtual machine (-4)
Error: package ‘xlsxjars’ could not be loaded
EDIT: Here's the problem. Sorry for any confusion. When I enter this:
filename<-file.choose() #select file
library(xlsx)
mydata<-read.xlsx(filename,1) #load datafile
I can successfully select the file name, but the xlsx package fails to load so I can't open the data file. I get the error above. However, if I run this instead (after I've closed and restarted RStudio):
library(xlsx)
filename<-file.choose() #select file
mydata<-read.xlsx(filename,1) #load datafile
The xlsx package loads properly, but file.choose
causes R to run indefinitely so the script freezes and I can't load my file. This is also the case using choose.files()
. I have no idea why those two things (xlsx, and file.choose
/choose.files
) would be conflicting but it appears that they are since I can only use one or the other depending on which one I use first.
EDIT 2: I've tried this on a different computer (same OS, same versions of R, RStudio, and Java) and I get the same problem.
EDIT 3: I converted back to RStudio v0.97.90 and the problem went away. I guess it is an RStudio problem.