rrstudioqdap

Package ("qdap") fails to load with multiple errors


While installing qdap I have not faced any errors. But when loading the library, I face the follwing errors.

> library(qdap)
Loading required package: qdapDictionaries
Loading required package: qdapRegex
Loading required package: qdapTools
Loading required package: RColorBrewer
Error: package or namespace load failed for ‘qdap’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: JAVA_HOME cannot be determined from the Registry

I read in another question that we need to install the JAVA 64bit (as my Win 10 is 64-bit) and load the JAVA home. So I downloaded the 64-bit java file and also set the JAVA_HOME to the directory.

> Sys.setenv(JAVA_HOME='C:/Program Files (x86)/Java/jre1.8.0_231')
> library(qdap)
Error: package or namespace load failed for ‘qdap’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/Users/Admin/Documents/R/win-library/3.6/rJava/libs/x64/rJava.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.

I have uninstalled and installed the latest R software (3.6.2; I've checked both 32-bit and 64-bit options), restarted R-studio as well, to no avail.


Solution

  • The issue is fixed. Although I'm not 100% sure what solved, here is what i have done.

    The error %1 is not a valid Win32 application. is indicating 32-bit.

    So I started Rgui console (32-bit) (opened from the directory C:\Program Files\R\R-3.6.2\bin\i386 ). The library(rJava) command works well and so does library(qdap).

    Then I changed the options in Rstudio to choose 32-bit R [Tools -> Options -> General]. But setting this will impact high memory consuming executions. After a while (when I started facing memory issues), I switched the RStudio to use the 64-bit R.

    The error did not appear after that and I was able to load the 'qdap' library.