无法安装 rgl 以安装 TSclust

Can't install rgl in order to install TSclust

不确定发生了什么,但我无法安装带或不带标志的 rgl:

> install.packages("rgl", dependencies=TRUE)
also installing the dependencies ‘mime’, ‘stringi’, ‘magrittr’, ‘bitops’, ‘evaluate’, ‘digest’, ‘formatR’, ‘highr’, ‘markdown’, ‘stringr’, ‘yaml’, ‘htmltools’, ‘caTools’, ‘knitr’, ‘rmarkdown’


  There are binary versions available but the source versions are
  later:
             binary    source needs_compilation
knitr        1.10.5      1.11             FALSE
rmarkdown       0.7       0.8             FALSE
rgl       0.95.1201 0.95.1337              TRUE

Do you want to install from sources the package which needs compilation?
y/n: y
trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/mime_0.4.tgz'
Content type 'application/x-gzip' length 24755 bytes (24 KB)
==================================================
downloaded 24 KB

trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/stringi_0.5-5.tgz'
Content type 'application/x-gzip' length 12685069 bytes (12.1 MB)
==================================================
downloaded 12.1 MB

trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/magrittr_1.5.tgz'
Content type 'application/x-gzip' length 145658 bytes (142 KB)
==================================================
downloaded 142 KB

trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/bitops_1.0-6.tgz'
Content type 'application/x-gzip' length 23364 bytes (22 KB)
==================================================
downloaded 22 KB

trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/evaluate_0.8.tgz'
Content type 'application/x-gzip' length 38270 bytes (37 KB)
==================================================
downloaded 37 KB

trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/digest_0.6.8.tgz'
Content type 'application/x-gzip' length 127790 bytes (124 KB)
==================================================
downloaded 124 KB

trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/formatR_1.2.1.tgz'
Content type 'application/x-gzip' length 45595 bytes (44 KB)
==================================================
downloaded 44 KB

trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/highr_0.5.1.tgz'
Content type 'application/x-gzip' length 28245 bytes (27 KB)
==================================================
downloaded 27 KB

trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/markdown_0.7.7.tgz'
Content type 'application/x-gzip' length 168867 bytes (164 KB)
==================================================
downloaded 164 KB

trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/stringr_1.0.0.tgz'
Content type 'application/x-gzip' length 77633 bytes (75 KB)
==================================================
downloaded 75 KB

trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/yaml_2.1.13.tgz'
Content type 'application/x-gzip' length 168133 bytes (164 KB)
==================================================
downloaded 164 KB

trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/htmltools_0.2.6.tgz'
Content type 'application/x-gzip' length 85318 bytes (83 KB)
==================================================
downloaded 83 KB

trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/caTools_1.17.1.tgz'
Content type 'application/x-gzip' length 182473 bytes (178 KB)
==================================================
downloaded 178 KB


The downloaded binary packages are in
    /var/folders/bk/2b2d879912bgnl5s768s7crh0000gn/T//Rtmp258LNe/downloaded_packages
installing the source packages ‘knitr’, ‘rmarkdown’, ‘rgl’

trying URL 'https://cran.rstudio.com/src/contrib/knitr_1.11.tar.gz'
Content type 'application/x-gzip' length 688792 bytes (672 KB)
==================================================
downloaded 672 KB

trying URL 'https://cran.rstudio.com/src/contrib/rmarkdown_0.8.tar.gz'
Content type 'application/x-gzip' length 1184516 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

trying URL 'https://cran.rstudio.com/src/contrib/rgl_0.95.1337.tar.gz'
Content type 'application/x-gzip' length 2189241 bytes (2.1 MB)
==================================================
downloaded 2.1 MB

* installing *source* package ‘knitr’ ...
** package ‘knitr’ successfully unpacked and MD5 sums checked
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (knitr)
* installing *source* package ‘rgl’ ...
** package ‘rgl’ successfully unpacked and MD5 sums checked
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking how to run the C preprocessor... clang -E
checking for gcc... (cached) clang
checking whether we are using the GNU C compiler... (cached) yes
checking whether clang accepts -g... (cached) yes
checking for clang option to accept ISO C89... (cached) none needed
checking whether __attribute__((visibility())) is supported... no
checking whether clang accepts -fvisibility... yes
checking whether  accepts -fvisibility... no
checking for libpng-config... yes
configure: using libpng-config
configure: using libpng dynamic linkage
checking for X... no
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’
Warning in install.packages :
  installation of package ‘rgl’ had non-zero exit status
* installing *source* package ‘rmarkdown’ ...
** package ‘rmarkdown’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (rmarkdown)

The downloaded source packages are in
    ‘/private/var/folders/bk/2b2d879912bgnl5s768s7crh0000gn/T/Rtmp258LNe/downloaded_packages’
> 

这是我在尝试安装 TSclust 时遇到的错误:

> install.packages("TSclust")
also installing the dependencies ‘rgl’, ‘longitudinalData’


  There are binary versions available but the source versions are
  later:
                    binary    source needs_compilation
rgl              0.95.1201 0.95.1337              TRUE
longitudinalData       2.3       2.4             FALSE

Do you want to install from sources the package which needs compilation?
y/n: y
trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2/TSclust_1.2.3.tgz'
Content type 'application/x-gzip' length 353039 bytes (344 KB)
==================================================
downloaded 344 KB


The downloaded binary packages are in
    /var/folders/bk/2b2d879912bgnl5s768s7crh0000gn/T//Rtmp258LNe/downloaded_packages
installing the source packages ‘rgl’, ‘longitudinalData’

trying URL 'https://cran.rstudio.com/src/contrib/rgl_0.95.1337.tar.gz'
Content type 'application/x-gzip' length 2189241 bytes (2.1 MB)
==================================================
downloaded 2.1 MB

trying URL 'https://cran.rstudio.com/src/contrib/longitudinalData_2.4.tar.gz'
Content type 'application/x-gzip' length 80334 bytes (78 KB)
==================================================
downloaded 78 KB

* installing *source* package ‘rgl’ ...
** package ‘rgl’ successfully unpacked and MD5 sums checked
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking how to run the C preprocessor... clang -E
checking for gcc... (cached) clang
checking whether we are using the GNU C compiler... (cached) yes
checking whether clang accepts -g... (cached) yes
checking for clang option to accept ISO C89... (cached) none needed
checking whether __attribute__((visibility())) is supported... no
checking whether clang accepts -fvisibility... yes
checking whether  accepts -fvisibility... no
checking for libpng-config... yes
configure: using libpng-config
configure: using libpng dynamic linkage
checking for X... no
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’
Warning in install.packages :
  installation of package ‘rgl’ had non-zero exit status
ERROR: dependency ‘rgl’ is not available for package ‘longitudinalData’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/longitudinalData’
Warning in install.packages :
  installation of package ‘longitudinalData’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/bk/2b2d879912bgnl5s768s7crh0000gn/T/Rtmp258LNe/downloaded_packages’
> 

这是我的 R 版本:

Monas-MacBook-Pro:clustering mona$ R

R version 3.2.2 (2015-08-14) -- "Fire Safety"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)

这里是 RStudio 版本:

RStudio
Version 0.99.473 – © 2009-2015 RStudio, Inc.
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko)

第一个和第二个错误都表明您缺少正确安装的 XQuartz 副本,它是 X11 的 MacOS 版本:https://xquartz.macosforge.org/landing/

(他们不建议你失踪XCode。)