问题描述
我是R语言编程的新手,所以如果我天真的话我会先向您道歉.我希望能够对3D数据进行一些主成分分析.我读到"pca3d"功能对此很有用,但是我需要下载"rgl"库.当我使用install.packages时,它会询问:
I'm new to programming in R so I apologise in advance if I seem naive. I want to be able to do some principal components analysis on my data in 3D. I read that the "pca3d" function is good for this, but I need to download the "rgl" library. When I use install.packages it asks:
install.packages("rgl")
There is a binary version available but the source version is later:
binary source needs_compilation
rgl 0.95.1201 0.95.1367 TRUE
Do you want to install from sources the package which needs compilation?
y/n: n
我尝试将其安装为二进制文件和源代码,但似乎没有任何效果.如果我尝试加载二进制版本,则会出现此错误:
I have tried installing it as both binary and source, but nothing seems to work. If I try loading the binary version, I get this 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 ‘rgl’
如果我对从源代码安装说是",则会出现以下错误:
If I say "yes" to installing from source, I get the following error:
configure: error: X11 not found but required, configure aborted.
ERROR: configuration failed for package ‘rgl’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl’
Warning in install.packages :
installation of package ‘rgl’ had non-zero exit status
我一直在寻找如何使之工作的时间,所以如果有人可以理解我应该如何安装rgl软件包,那么我将非常感激!
I've been searching for hours on how to make this work so if someone could run through how I should go about installing the rgl package then I would be extremely grateful!
谢谢,克莱尔
推荐答案
与同事交谈后,我要做的就是从此处安装X11,然后再次安装源程序包.现在可以了!
After talking with a colleague all I had to do was download XQuartz from here to install X11, and then install the source package again. Now it works!
这篇关于安装"rgl" R,Mac OSX El Captian中的软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!