我刚开始接触R编程,如果我的问题显得很幼稚,请多多包涵。我想对我的三维数据进行主成分分析。我读到“pca3d”函数对此很有用,但我需要下载“rgl”库。当我使用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’
如果我选择从源代码安装,会出现以下错误:
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包,我将非常感激!
谢谢, Claire