R libraries won't load after upgrading - r

I upgraded my R version today from 3.1 to 3.2. In doing so, I kept a copy of my original libraries in a separate folder. After installing version 3.2, I pasted the libraries in the libraries folder of R 3.2.
After doing so, I upgraded Bioconductor, and updated all its packages.
However, when I try to load some (not all) bioconductor packages right now in R, I get the following error:
library(ballgown)
Error : .onLoad failed in loadNamespace() for 'XML', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Users/user/Library/R/3.2/library/XML/libs/XML.so':
dlopen(/Users/user/Library/R/3.2/library/XML/libs/XML.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/3.1/Resources/lib/libR.dylib
Referenced from: /Users/user/Library/R/3.2/library/XML/libs/XML.so
Reason: image not found
Error: package or namespace load failed for ‘ballgown’
It looks like he's still looking for something in the older 3.1 version, but I deleted that folder.
Here is my library path in R:
.libPaths()
[1] "/Users/user/Library/R/3.2/library"
[2] "/Library/Frameworks/R.framework/Versions/3.2/Resources/library"
Remarkably, when loading the same packages in RStudio, the error does not pop up. How can I still fix this?
Thanks.

Related

I am facing issues while trying to install emojifont package on Mac book

I am installing emojifont package. The package installs properly however when I try to call it through the library function I get the following error
Error: package or namespace load failed for ‘emojifont’:
.onLoad failed in loadNamespace() for 'sysfonts', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/sysfonts/libs/sysfonts.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/sysfonts/libs/sysfonts.so, 6): Library not loaded: /opt/X11/lib/libfreetype.6.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/sysfonts/libs/sysfonts.so
Reason: image not found
What ended up working for me was installing XQuartz. I had this problem with both emojifont and sysfonts until I installed XQuartz and then both loaded without problems. I can't tell you much about what XQuartz is doing but it seems to be needed for the compatibility between MacOS and these packages.
Other people with this problem seemed to be having issues with their sysfonts install (like it needed to be updated, etc.) but that didn't work for me, instead I got an error when using trying to load both the sysfonts and the emojifont package. If you look at this line in the error "Library not loaded: /opt/X11/lib/libfreetype.6.dylib", that seems to be missing in the error message of people with only the sysfonts problem.
Hope this saves someone the 2 hours I just spent searching!

error message trying to install homals package in R

I'm trying to install the Homals package - library(homals), but keep getting this error message:
library(homals)
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.3/Resources/library/rgl/libs/rgl.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/libs/rgl.so,
6): Library not loaded: /opt/X11/lib/libGLU.1.dylib Referenced from:
/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/libs/rgl.so
Reason: image not found Error: package or namespace load failed for
‘homals’
I have a couple of my colleagues to run the same code, the same thing happens. I have re-install R studio to the newest version.
install.packages("rgl")
install.packages("homals")
library(homals)
Any solutions for this? thank you.
I was able to successfully install on both Windows and Mac. I believe the root cause here is that you have R version 3.3 installed when you require at least v3.5.3 as per below:
library(homals)
Warning message:
package ‘homals’ was built under R version 3.5.3

difficulty loading packages in R

I have spent hours trying to think of a ways to install some packages in R that just refuse to load. I have tried uninstalling and installing again, downloading from URL etc etc. but nothing seems to work. Please help me before I give up on teach entirely
{
library(psych)
Error: package or namespace load failed for ‘psych’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/alan/Library/R/3.5/library/lattice/libs/lattice.so':
dlopen(/Users/alan/Library/R/3.5/library/lattice/libs/lattice.so, 6): Library not loaded: #rpath/R/lib/libR.dylib
Referenced from: /Users/alan/Library/R/3.5/library/lattice/libs/lattice.so
Reason: Incompatible library version: lattice.so requires version 3.5.0 or later, but libR.dylib provides version 3.1.0
I had a previous version of R installed so found the directory a directory full of libraries that must have been clashing. I just deleted the whole folder and went from scratch

Trouble adding package to library() after installing package

I keep getting the same error, for both first for XLConnect, (which I thought was a java problem) and now rJava (which is also not working). This is the error message I get when I library(rJava):
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
'/Users/snyderk2/Library/R/3.4/library/rJava/libs/rJava.so':
dlopen(/Users/snyderk2/Library/R/3.4/library/rJava/libs/rJava.so, 6):
Library not loaded: #rpath/libjvm.dylib Referenced from:
/Users/snyderk2/Library/R/3.4/library/rJava/libs/rJava.so Reason:
image not found
I am new to R, and just need to figure out how to get these packages working, thanks!
Try (check your java version and change accordingly):
Sys.setenv(JAVA_HOME = "C:/Program Files/Java/jre-9.0.1")
And then load library.
Install package xlsx if you are trying to access Excel file by entering install.packages("xlsx", dependencies = T) in your console.
Another R package for working with excel data which does not require rJava is openxlsx. I've found it works faster than java-based packages, which is a nice bonus.

When loading a package, R is unable to load libRlapack.dylib

I recently updated my R (on Mac) from Version 3.0.2 to 3.1.1. I tried to load a package by using library(WRScpp)
But I got an error as shown below:
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/WRScpp/libs/WRScpp.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/WRScpp/libs/WRScpp.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/3.0/Resources/lib/libRlapack.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/WRScpp/libs/WRScpp.so
Reason: image not found
Error: package or namespace load failed for ‘WRScpp’
It seems that R tried to load libRlapack.dylib by looking for it in the wrong directory (it looked for it in the Version 3.0 directory). I wonder what can be done to direct R to search the correct directory?

Resources