Able to download package in R but not call it from library? - r

I was able to download the package "LMERConvenienceFunctions"
The downloaded binary packages are in
/var/folders/2p/3h5yk1gx4fs1gd8gtdbhdd900000gn/T//RtmpHvJyRm/downloaded_packages
However when I try to call it using:
library(LMERConvenienceFunctions)
I get the following error:
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 ‘LMERConvenienceFunctions’
Does anyone have any suggestions?
Thanks!

It seems like you have tried to install the "LMERConvenienceFunctions" package without also downloading it's dependencies? Running
install.packages("LMERConvenienceFunctions")
and then just using library(LMERConvenienceFunctions) worked for me in this case. If this still doesn't work, try manually installing rgl

My issue turned out to be that I didn't have XQuartz installed. It can be downloaded here: http://www.xquartz.org/
After installing it, rgl began to work, and then LMERConvenienceFunctions finally started working as well. The whole process took a few tweaks so I'm pasting the entire code below. Note that this is after installing XQuartz.
install.packages("LMERConvenienceFunctions")
install.packages("devtools") #not sure if this is necessary, but doing this before rgl was recommended on another answer on here#
library(devtools)
install.packages("rgl")
rgl.useNULL=TRUE #little thing I had to do even after installing XQuartz#
library(rgl)
library(LMERConvenienceFunctions)

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!

RStudio won't allow me to install the package 'imager'

Installed RStudio using Anaconda Navigator even though I already had RStudio and it was working fine before. The package 'imager' didn't load so I removed the application from Navigator and completely uninstall R and RStudio from my Macbook and reinstalled R and the application through Navigator, but that didn't fix things. Other packages install just fine. The following is the error message:
library(imager)
Error: package or namespace load failed for ‘imager’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/omeedkashef/Library/R/3.4/library/imager/libs/imager.so':
dlopen(/Users/omeedkashef/Library/R/3.4/library/imager/libs/imager.so, 6): Library not loaded: /opt/X11/lib/libX11.6.dylib
Referenced from: /Users/omeedkashef/Library/R/3.4/library/imager/libs/imager.so
Reason: image not found
I had this same problem. I did not have a problem installing imager from CRAN but did get an error message when trying to load the CRAN-installed package. When I tried installing from GitHub I got the more useful error message saying that X11 was not found (same as #andrii above). I solved all issues by installing X11 by downloading from this site: https://www.xquartz.org/
EDIT: I should mention that this is not a problem with RStudio per se, as the header of the question suggests, but rather just a dependency issue of one package (imager) on a not-explicitly R piece of sofware (X11).

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.

R: object ‘set_global_graph_attrs’ is not exported from 'namespace:DiagrammeR'

I wanted to install Mxnet library and found on this forum the topic where was described how do it .
cran <- getOption("repos")
cran["dmlc"] <- "https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/"
options(repos = cran)
install.packages("mxnet")
library("mxnet")
and then i got the error
Error: package or namespace load failed for ‘mxnet’:
object ‘set_global_graph_attrs’ is not exported from 'namespace:DiagrammeR'
what's wrong?
DiagrammeR library is installed.
There is some weird thing goes with mxnet installation on windows. I also experienced that problem a few days ago. What helped me is to install diagrammeR 0.9 manually:
# Make sure you have devtools installed already
require(devtools)
install_version("DiagrammeR", version = "0.9.0", repos = "http://cran.us.r-project.org")
require(DiagrammeR)
And after doing that, try to install mxnet - now it should work.
Let me know if it helps.
I had exactly the same problem with loading mxnet. Your suggestion of installing DiagrammeR manually seems to have fixed it. Unfortunately, it simply exposed another error.
Error: package or namespace load failed for ‘mxnet’:
.onLoad failed in loadNamespace() for 'mxnet', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Users/steve/Documents/R/win-library/3.4/mxnet/libs/x64/libmxnet.dll':
LoadLibrary failure: The specified module could not be found.
I think the "onLoad" function must be missing. The dll referenced above, libmxnet.dll, is exactly where it should be.

Unable to load caret package in R on R 3.1.0 on OSX 10.9

I installed the R caret package using install.packages command and did library(caret). I am recieving the following error
>library(caret)
Loading required package: lattice
Loading required package: ggplot2
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so, 10): Library not loaded: /usr/local/lib/libtcl8.6.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so
Reason: image not found
Error: package or namespace load failed for ‘caret’
I searched other posts and also installed OSX tcltk package from http://cran.us.r-project.org/bin/macosx/tools/ but it still does not seem to work. I also installed tcltk2 package from R but still does not work.. Kindly help
I have met the same problem with the same error message but unfortunately, just reinstalling R1.3 didn't solve the problem for me.
To solve it, I had to install X-Quartz as explained here in the "Mac OS X Trouble-shooting" section and the problems related to tcltk.
Do this and it will resolve the problem
install.packages("quantreg")
What version of R are you using? Do you use Mavericks? You may need to update to a version which includes Mavericks updates.
http://cran.r-project.org/bin/macosx/
I had the same issue. Reinstalling Quartz solved the issue
Try this, worked for me.
install.packages("caret", dependencies = T)
Once that is done, run
install.packages("pbkrtest", dependencies = T)

Resources