Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R:install.packages错误_R - Fatal编程技术网

R:install.packages错误

R:install.packages错误,r,R,我只是想简单地安装一个软件包,整个事情就是FUBAR。本周早些时候工作得很好。没有接触防火墙设置或任何东西,并且尝试在两个独立网络上的两台独立计算机上同时安装“readxl”和“dplyr”(dplyr只是为了测试问题是否是readxl软件包),问题仍然存在。在我的手机上尝试了我的家庭互联网(wifi和硬线)以及移动热点。如何让它恢复正常,快速、轻松地下载和安装软件包 > install.packages("readxl") Warning in install.packages :

我只是想简单地安装一个软件包,整个事情就是FUBAR。本周早些时候工作得很好。没有接触防火墙设置或任何东西,并且尝试在两个独立网络上的两台独立计算机上同时安装“readxl”和“dplyr”(dplyr只是为了测试问题是否是readxl软件包),问题仍然存在。在我的手机上尝试了我的家庭互联网(wifi和硬线)以及移动热点。如何让它恢复正常,快速、轻松地下载和安装软件包

> install.packages("readxl")
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
  cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Installing package into ‘C:/Users/grant/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
Warning in install.packages :
  unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
  cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
Warning in install.packages :
  unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4:
  cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4/PACKAGES'
trying URL 'http://cran.mtu.edu/bin/windows/contrib/3.4/readxl_1.0.0.zip'
Content type 'application/zip' length 1461628 bytes (1.4 MB)
downloaded 1.4 MB

package ‘readxl’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\grant\AppData\Local\Temp\Rtmpwb6TUN\downloaded_packages
@Kevin,我使用chooseCRANmirror选择了密歇根州的CRAN mirror,但install.packages仍然默认为原始的坏镜像

> chooseCRANmirror(local.only = TRUE)
Secure CRAN mirrors 

 1: 0-Cloud [https]                 2: Australia (Canberra) [https]    3: Australia (Melbourne) [https]
 4: Australia (Perth) [https]       5: Austria [https]                 6: Belgium (Ghent) [https]      
 7: Brazil (RJ) [https]             8: Brazil (SP 1) [https]           9: Bulgaria [https]             
10: Chile 1 [https]                11: China (Lanzhou) [https]        12: Colombia (Cali) [https]      
13: Czech Republic [https]         14: Denmark [https]                15: France (Lyon 1) [https]      
16: France (Lyon 2) [https]        17: France (Marseille) [https]     18: France (Montpellier) [https] 
19: France (Paris 2) [https]       20: Germany (Münster) [https]      21: Iceland [https]              
22: Indonesia (Jakarta) [https]    23: Ireland [https]                24: Italy (Padua) [https]        
25: Japan (Tokyo) [https]          26: Malaysia [https]               27: Mexico (Mexico City) [https] 
28: Norway [https]                 29: Philippines [https]            30: Russia (Moscow) [https]      
31: Spain (A Coruña) [https]       32: Spain (Madrid) [https]         33: Sweden [https]               
34: Switzerland [https]            35: UK (Bristol) [https]           36: UK (Cambridge) [https]       
37: UK (London 1) [https]          38: USA (CA 1) [https]             39: USA (KS) [https]             
40: USA (MI 1) [https]             41: USA (TN) [https]               42: USA (TX 1) [https]           
43: USA (TX 2) [https]             44: (other mirrors)                

Selection: 40
> install.packages("dplyr")
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
  cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Installing package into ‘C:/Users/grant/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
Warning in install.packages :
  unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
  cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  InternetOpenUrl failed: 'A connection with the server could not be established'
Warning in install.packages :
  unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4:
  cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4/PACKAGES'
trying URL 'https://cran.mtu.edu/bin/windows/contrib/3.4/dplyr_0.7.1.zip'
Content type 'application/zip' length 2881930 bytes (2.7 MB)
downloaded 2.7 MB

package ‘dplyr’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\grant\AppData\Local\Temp\RtmpQXhfjF\downloaded_packages
我的默认CRAN镜像也已更新,但即使在重新启动RStudio后似乎也没有效果。

*****临时修复***** 必须运行以下代码: a) 切换默认CRAN镜像后 及 b) 在每节课开始时

options(repos = getOption("repos")["CRAN"])
options(repos = getOption("repos")["CRAN"])

我遇到了同样的问题,整天都在解决它。我尝试了几种不同的CRAN镜子,最后这一种起了作用:

install.packages('readxl',dependencies=TRUE,repos='')


下载立即发生。

看起来像是一个bug,RStudio选项中有一个额外的镜像,指向一个不稳定的目标。据报道,RStudio已经意识到了这个问题,确认这是一个bug,并将在下一版本中修复

必须首先更改默认的CRAN镜像,然后在每次会话开始时仍必须运行临时解决方案

options(repos = getOption("repos")["CRAN"])
options(repos = getOption("repos")["CRAN"])
相关职位:


谢谢你帮我缩小这个问题,凯文。

试着增加超时限制(可能300而不是100)


选项(超时=300)

尝试其他下载镜像。这一个看起来像是移动了或是向下移动了。在特定的会话中,我如何做到这一点?我尝试将我的Rprofile CRAN设置更改为密歇根州的镜像,重新启动R,然后使用install.packages运行“repos=getOption(“repos”),但仍然遇到错误。它看起来仍然指向原始镜像。我应该做些别的事吗?抱歉,不太熟悉后端设置选项。再次感谢。请尝试运行'chooseCRANmirror(),并选择最近的一个。Kevin,在尝试您的建议后编辑OP。使用临时解决方案更新OP。看起来这是一个bug,在RStudio选项中烘焙了一个额外的镜像,指向一个不稳定的目标。据报道,RStudio已经意识到了这个问题,确认这是一个bug,并将在下一版本中修复。临时解决方案必须在每次会话开始时运行。相关帖子:凯文,谢谢你在缩小问题范围方面的帮助。嗨,麦克,谢谢你的建议。不幸的是,对我来说,它仍然默认为最初的坏CRAN mirror,然后仅在近2分钟内第一次多次失败后才检查提供的回购。这是一个RStudio错误。谢谢你的意见。