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

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

 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) 

不是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) 

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

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

我希望这可以节省一些小时的挫折感。

我认为这是“设置它,忘记它”的解决scheme:

 options(repos='http://cran.rstudio.com/') 

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

正如@Pascal所说,很可能您遇到了防火墙或/和代理问题。 作为第一步,请在CRAN网页上浏览FAQ 。 之后,尝试使用–internet2标记R.

有时在R studio中检查全局选项可能会很有用,并取消选中“使用Internet Explorer库/ HTTP代理”。 工具 – >全局选项 – >打包并取消选中“使用Internet Explorer库/代理HTTP”选项。

希望这可以帮助。

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

  1. 从官方的常见问题和支持论坛和这个答案 ,你可能有一个防火墙或代理问题,阻止RStudio连接到互联网:

    • 禁用任何防火墙
    • 工具 – >全局选项 – >打包并取消选中“使用Internet Explorer库/代理HTTP”选项并重新启动R( #1 , #2 , #3 )
    • 将R标记为–internet2
    • 在CentOS上,build议尝试以下操作: install.packages('package_name', dependencies=TRUE, repos='http://cran.rstudio.com/')
  2. 几个答案build议使用替代镜像( #1 , #2 , #3 ):

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

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

如果你在Windows上,试试这个:

"C:\Program Files\RStudio\bin\rstudio.exe" http_proxy=http://host:port/

我的解决scheme工作是打开R studio选项,并select全局镜像(该字段是空的之前)和错误消失。

什么对我有效:

首选项 – 常规 – 默认工作目录 – 浏览从全局镜像切换到本地镜像

在Mac上工作。 10.10.3

请检查以下内容以安装新软件包:

1-在工具 – >全局选项 – >软件包中,取消选中“使用Internet Explorer库/代理HTTP”选项,

2-在工具 – >全局选项 – >软件包中,将CRAN镜像更改为“0-云 – Rstudio,自动redirect到全球服务器”

3-重新启动Rstudio。

4-玩得开心!

大多数时候@cer解决scheme工作,但如果万一它不工作,然后尝试安装在基地R(不在R工作室)。 由于R工作室在后台运行基本R可执行文件,所以R工作室也可以使用新的软件包。 [我在macOS上的经验]