Error loading XLConnect (loadNamespace error, argument is of length zero)

641 views Asked by At

When loading

library(XLConnect)

I get the error message

Error: package or namespace load failed for ‘XLConnect’:
.onLoad failed in loadNamespace() for 'XLConnect', details:
call: if (twoFirst == "1.") {
error: argument is of length zero

This program has been working smoothly for months, this is out of the blue after no changes to the code. I have seen that many issues have come from Java, and have installed latest Java (V8 update 281) in 32 and 64-bit flavors. In addition, I have tried switching RStudio to 32 bit from 64 with no change in the result. Also have reinstalled the XLConnect package, rJava package, restarted, ensured R is running as administrator, all with still the same error.

What happened and why is it not loading?

Running R 4.0.4 and RStudio 1.4.1103 on Windows 10 x64.

I will probably switch to readxl after this, but that will take time.

1

There are 1 answers

0
Luis On

One of my students was experiencing exactly the same problem mentioned above (in our case, with R version 4.0.3 in Windows 10, Java 1.8) and no solution was working for him. However, a few minutes ago, exploring his environment variables, we noticed that he had environment variable _JAVA_OPTIONS set to -Xmx512m. Once we have removed such variable, XLConnect is working properly.