Xlsx library will not load properly in R - r

I installed the xlsx package in R, but when I tried to load the library I got the following message:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/lib/server/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so
Reason: image not found
The Mac is version 10.14.1 Mojave. R is version 3.5.1. Java version is 1.8.0_73. Java and Mac are both 64 bits as I saw that as an issue with other question submissions. Is this a problem related to the newest macOS Mojave?

Related

Error loading Glimma and edgeR packages on Mac

we are trying to load the edgeR and Glimma packages on a Mac OS version 11.0. We have installed and loaded other packages successfully from Bioconductor including limma. It appears that the install of both was successful, but when trying to load the packages we get the following error messages:
library(edgeR)
Error: package or namespace load failed for ‘edgeR’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/edgeR/libs/edgeR.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/edgeR/libs/edgeR.so, 6): Symbol not found: __ZNKSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strEv
Referenced from: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/edgeR/libs/edgeR.so (which was built for Mac OS X 13.0)
Expected in: /usr/lib/libc++.1.dylib
> library(Glimma)
Error: package or namespace load failed for ‘Glimma’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/DESeq2/libs/DESeq2.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/DESeq2/libs/DESeq2.so, 6): Symbol not found: __ZNKSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strEv
Referenced from: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/DESeq2/libs/DESeq2.so (which was built for Mac OS X 13.0)
Expected in: /usr/lib/libc++.1.dylib
The RStudio version is 2022.12.0+353
The macOS is 11.2.2 BigSur

Issues with loading XLConnect library in R

I have installed XLConnect package though my R studio. When I try to load the library I get the following error
> library(XLConnect)
Loading required package: XLConnectJars
Error: package or namespace load failed for ‘XLConnectJars’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
Error: package ‘XLConnectJars’ could not be loaded
I checked the /Library/Frameworks/R.framework/Versions/3.4/Resources/library folder and I am noticed all three mentioned libraries(XLConnect, XLConnectJars, rJava) already present.

Conflicts between MacOS High Sierra and R packages

I am running MacOS 10.13 (High Sierra) and recently updated to R version 3.4.3 and R studio version 1.1.419. For some reason the rJava package is not working...tried several fixes from here on stackoverflow and nothing works. Also, the digest package will not load so I can no longer use ggplot2. Any suggestions?
Error for Java:
> library("rJava", lib.loc="/Library/Frameworks/R.framework/Versions/3.4/Resources/library")
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
Error for digest package:
> library("rJava", lib.loc="/Library/Frameworks/R.framework/Versions/3.4/Resources/library")
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
New Mac OSX releases have a documented problem of messing up the Java path in R/RStudio (see here). It looks as though that this is what you're encountering here.
If you check out the question I've linked above, hopefully you can find a solution that works to reset your path; both of the commands below worked for me.
dyn.load('/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/lib/server/libjvm.dylib')
or
sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
I don't know about the problem with rJava, but digest was just updated so if you try to install the binary it may not compiled and built yet. If that ever happens (it's somewhat of a race condition/lag), you can try to reinstall form source:
install.packages("digest", type = "source")

Error in installing "rgl" package in Yosemite 10.10.4

I get this message whenever I try to install rgl package on Yosemite 10.10.4
Error : .onLoad failed in loadNamespace() for 'rgl', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl/libs/rgl.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl/libs/rgl.so, 6): Library not loaded: /opt/X11/lib/libGLU.1.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl/libs/rgl.so
Reason: image not found
Error: package or namespace load failed for ‘rgl’
How can I fix this?
Six years too late but for other people searching for a solution. The solution that worked for me is to download and install XQuartz https://www.xquartz.org
See Stackoverflow answers here and here

Error while loading "rgl" package in R on mac os x

I have an error when try to open rgl library:
Error : .onLoad failed in loadNamespace() for 'rgl', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rgl/libs/rgl.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rgl/libs/rgl.so, 6): Library not loaded: /opt/X11/lib/libGLU.1.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rgl/libs/rgl.so
Reason: image not found
Any solutions?
You need to have XQuartz installed on OSX for rgl to work.

Resources