简体   繁体   English

在R,Mac OSX El Captian中安装“rgl”软件包

[英]Installing “rgl” package in R, Mac OSX El Captian

I'm new to programming in R so I apologise in advance if I seem naive. 我是R的新编程所以如果我看起来天真,我会事先道歉。 I want to be able to do some principal components analysis on my data in 3D. 我希望能够对我的3D数据进行一些主成分分析。 I read that the "pca3d" function is good for this, but I need to download the "rgl" library. 我读到“pca3d”函数对此有好处,但我需要下载“rgl”库。 When I use install.packages it asks: 当我使用install.packages时,它会询问:

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

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! 我一直在寻找如何使这项工作的时间,所以如果有人可以试图我应该如何安装rgl包,那么我将非常感激!

Thanks, Claire 谢谢,克莱尔

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. 在与同事交谈后,我所要做的就是从这里下载XQuartz来安装X11,然后再次安装源代码包。 Now it works! 现在它有效!

在我浪费时间试图找到解决这个问题的方法后,下载XQuartz完全解决了所有问题。

I first downloaded the package onto my desktop, but R gave me the same error, this is what worked for my Mac: 我首先将软件包下载到我的桌​​面上,但R给了我同样的错误,这对我的Mac有用:

install.packages("rgl", lib="Desktop/rgl_0.96.0 (1).tgz") Warning in install.packages : 'lib = "Desktop/rgl_0.96.0 (1).tgz"' is not writable Would you like to use a personal library instead? install.packages(“rgl”,lib =“Desktop / rgl_0.96.0(1).tgz”)install.packages中的警告:'lib =“Desktop / rgl_0.96.0(1).tgz”'不可写你愿意吗?喜欢使用个人图书馆吗? (y/n) y Would you like to create a personal library ~/Library/R/3.3/library to install packages into? (是/否)你想创建一个个人库〜/ Library / R / 3.3 /库来安装包吗? (y/n) y (是/否)y

In my case, not only install XQuartz but I need to also open XQuartz.app manually and then run install.packages("rgl"). 在我的例子中,不仅要安装XQuartz,还需要手动打开XQuartz.app,然后运行install.packages(“rgl”)。

Only by this way would R found X11 in my case... 只有通过这种方式,R才能在我的案例中找到X11 ......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM