无法在最新版本的RStudio和R Version.3.1.1中安装软件包

man*_*har 64 r

我无法通过RStudio and R Version.3.1.1.Kindly帮助的最新版本安装软件包.我得到了如下所述的错误:

Example:
Warning in install.packages :
  InternetOpenUrl failed: ''
Warning in install.packages :
  InternetOpenUrl failed: ''
Warning in install.packages :
  unable to access index for repository http://cran.rstudio.com/bin/windows/contrib/3.1
Installing package into ‘C:/Users/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
  InternetOpenUrl failed: ''
Warning in install.packages :
  InternetOpenUrl failed: ''
Warning in install.packages :
  unable to access index for repository http://cran.rstudio.com/bin/windows/contrib/3.1
Warning in install.packages :
  package ‘reshape’ is not available (for R version 3.1.1)
Run Code Online (Sandbox Code Playgroud)

cer*_*cer 135

不是100%肯定你有同样的问题,但我发现我的工作阻止提供的每个镜像站点选项的困难方式,我得到这样的错误:

Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) : 
  unsupported URL scheme
Warning: unable to access index for repository https://rweb.crmda.ku.edu/cran/src/contrib
Warning message:
package ‘ggplot2’ is not available (for R version 3.2.2)
Run Code Online (Sandbox Code Playgroud)

解决方法(我正在使用CentOS)...

install.packages('package_name', dependencies=TRUE, repos='http://cran.rstudio.com/')
Run Code Online (Sandbox Code Playgroud)

我希望这能节省数小时的挫折感.

  • 另请注意,如果尝试使用https而不是http,则可能无法访问存储库的索引。 (3认同)
  • 对我来说很奇怪,因为我能够在今天早上安装软件包之前没有问题...但是这立即起作用了. (2认同)

rba*_*att 68

我认为这是"设置并忘记它"的解决方案:

options(repos='http://cran.rstudio.com/')
Run Code Online (Sandbox Code Playgroud)

请注意,这不是https.我在Linux机器上,ssh'ing.如果我使用https,它不起作用.

  • 我的问题从 repos='https://cran.rstudio.com/' 到 ...http... (2认同)
  • 工具 - >全局选项 - >包 - >我取消选中使用HTTP的安全下载方法,它工作,所有问题都消失了,R还提供了该选项,你需要选择"其他镜像"并选择0 Clould并点击OK (2认同)

New*_*e_R 7

正如@Pascal所说,您可能遇到防火墙或/和代理问题.首先,请浏览CRAN网页上的常见问题解答.在此之后,尝试R标志与--internet2.

有时,检查R studio中的全局选项并取消选中"使用Internet Explorer库/代理HTTP"可能很有用.工具 - >全局选项 - >打包并取消选中"使用Internet Explorer库/代理进行HTTP"选项.

希望这可以帮助.


Tas*_*Tas 6

根据社区的答案,似乎有几种方法可以解决这个问题:

  1. 官方常见问题解答支持论坛以及此答案中,您可能遇到阻止RStudio连接到互联网的防火墙或代理问题:

    • 禁用任何防火墙
    • 工具 - >全局选项 - >打包并取消选中"使用Internet Explorer库/代理进行HTTP"选项并重新启动R(#1,#2,#3)
    • 标志R与--internet2
    • 在CentOS上,建议尝试以下方法:install.packages('package_name', dependencies=TRUE, repos='http://cran.rstudio.com/')
  2. 有几个答案建议使用备用镜像(#1,#2,#3):

    • 首选项>常规>默认工作目录>从本地/全局浏览并切换镜像(取消选中)
  3. 在Windows上,您可以启动应用程序http_proxy=http://host:port/:

    • "C:\Program Files\RStudio\bin\rstudio.exe" http_proxy=http://host:port/
  4. 关机并重启.经过上述许多操作后需要,并建议单独使用.