【问题标题】:Error while installing ggplot2 package安装 ggplot2 包时出错
【发布时间】:2015-12-10 06:28:28
【问题描述】:

我无法安装ggplot2 软件包。我尝试运行下面的代码。

install.packages("ggplot2")
 also installing the dependencies ‘stringi’, ‘colorspace’, ‘Rcpp’,     ‘stringr’, ‘munsell’, ‘plyr’, ‘digest’, ‘reshape2’, ‘scales’

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/stringi_1.0-1.zip'
Content type 'application/zip' length 14265659 bytes (13.6 MB)
downloaded 13.6 MB

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/colorspace_1.2-6.zip'
Content type 'application/zip' length 392857 bytes (383 KB)
downloaded 383 KB

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/Rcpp_0.12.2.zip'
Warning in install.packages :
InternetOpenUrl failed: 'The operation timed out'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/Rcpp_0.12.2.zip'
Warning in install.packages :
 download of package ‘Rcpp’ failed
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/stringr_1.0.0.zip'
Content type 'application/zip' length 83159 bytes (81 KB)
downloaded 81 KB

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/munsell_0.4.2.zip'
Content type 'application/zip' length 125762 bytes (122 KB)
downloaded 122 KB

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/plyr_1.8.3.zip'
Warning in install.packages :
InternetOpenUrl failed: 'The operation timed out'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/plyr_1.8.3.zip'
Warning in install.packages :
download of package ‘plyr’ failed
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/digest_0.6.8.zip'
Content type 'application/zip' length 151939 bytes (148 KB)
downloaded 148 KB

trying URL 

'http://cran.rstudio.com/bin/windows/contrib/3.2/reshape2_1.4.1.zip'
  Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
  Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/reshape2_1.4.1.zip'
  Warning in install.packages :
  download of package ‘reshape2’ failed
  trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/scales_0.3.0.zip'
  Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
  Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/scales_0.3.0.zip'
  Warning in install.packages :
  download of package ‘scales’ failed
  trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/ggplot2_1.0.1.zip'
  Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
  Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/ggplot2_1.0.1.zip'
  Warning in install.packages :
  download of package ‘ggplot2’ failed
  package ‘stringi’ successfully unpacked and MD5 sums checked
  package ‘colorspace’ successfully unpacked and MD5 sums checked
  package ‘stringr’ successfully unpacked and MD5 sums checked
  package ‘munsell’ successfully unpacked and MD5 sums checked
  package ‘digest’ successfully unpacked and MD5 sums checked

我尝试单独安装plyr 包,但我得到了同样的错误

InternetOpenUrl 失败:“操作超时”

在安装依赖包时Rcppplyr也失败了

【问题讨论】:

  • 如何选择镜像?我没有选择任何镜像@Pascal的选项
  • 你的操作系统是什么?你是通过 RStudio 安装的吗?如果在 Linux 上,您家中有 Rprofile 文件吗?
  • @Pascal 我在 Windows 7 上工作,是的,通过 RStudio 安装,我的 R 版本是 3.2。除此之外,我还尝试从 CRAN 下载 .tar 文件并安装该软件包。但这也失败了。
  • 您可以更改 RStudio 中的默认镜像。在工具 > 全局选项中搜索

标签: r


【解决方案1】:

试试下面的语法是否适合你:

install.packages("ggplot2", dependencies = TRUE, repos = "http://cran.rstudio.com/")

镜像名称可以通过“repos”更改。

【讨论】:

  • 尝试了同样的方法,但我仍然收到相同的错误“InternetOpenUrl failed: 'The operation timed out'”
  • 你的代码安装了几个依赖包,包括 plyr 但 ggplot2 失败了。
猜你喜欢
  • 2014-05-08
  • 2015-05-07
  • 1970-01-01
  • 2016-09-28
  • 2020-02-23
  • 2018-01-02
  • 2015-10-01
  • 2013-08-01
  • 1970-01-01
相关资源
最近更新 更多