如何在Mac的R版本3.2.1中安装ggp​​lot2

use*_*783 3 install packages r ggplot2 osx-mountain-lion

我刚刚下载了R和Rstudio的新Mac版本,但是当我尝试通过Rstudio界面安装ggp​​lot2时收到以下错误消息。有替代方法吗?

> install.packages("ggplot2")
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/src/contrib
Warning in install.packages :
  package ‘ggplot2’ is not available (for R version 3.2.1)
Installing package into ‘/Users/tom.glaser/Library/R/3.2/library’
(as ‘lib’ is unspecified)
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/src/contrib
Warning in install.packages :
  package ‘ggplot2’ is not available (for R version 3.2.1)
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/bin/macosx/contrib/3.2
Warning message:
package ‘ggplot2’ is not available (for R version 3.2.1) 
Run Code Online (Sandbox Code Playgroud)

我的会话信息是:

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
Running under: OS X 10.8.5 (Mountain Lion)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_3.2.1
Run Code Online (Sandbox Code Playgroud)

我不知道它是否重要,但是我尝试过的许多其他软件包(包括psych和Hmisc)也遇到类似的问题。我能够安装dplyr(0.4.2版)。我尝试回到R的早期版本,但是发现的Mac版本太旧了:https : //cran.r-project.org/bin/macosx/old/index-old.html

use*_*783 5

通过进入Rstudio,然后单击“工具”,然后单击“选项”,我解决了问题。然后,我从弹出框中选择“软件包”。这会弹出“软件包安装”屏幕,在其中单击CRAN镜像旁边的“更改”,然后选择名为USA(CA 1)-加利福尼亚大学伯克利分校的镜像。