能够在R中下载包但不能从库中调用它吗?

时间:2016-03-18 23:51:57

标签: r installation dependencies package quartz-graphics

我能够下载“LMERConvenienceFunctions”包

The downloaded binary packages are in
/var/folders/2p/3h5yk1gx4fs1gd8gtdbhdd900000gn/T//RtmpHvJyRm/downloaded_packages

但是,当我尝试使用以下方式调用它时:

library(LMERConvenienceFunctions)

我收到以下错误:

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’

有人有任何建议吗?

谢谢!

2 个答案:

答案 0 :(得分:4)

您似乎尝试安装“LMERConvenienceFunctions”软件包而不下载它的依赖项?正在运行

install.packages("LMERConvenienceFunctions")

然后在这种情况下只使用library(LMERConvenienceFunctions)为我工作。如果仍然无效,请尝试手动安装rgl

答案 1 :(得分:2)

我的问题原来是我没有安装XQuartz。可以在此处下载:http://www.xquartz.org/

安装后,rgl开始工作,然后LMERConvenienceFunctions终于开始工作了。整个过程进行了一些调整,所以我粘贴了下面的整个代码。请注意,这是在安装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)