在Windows中更新R.

use*_*411 13 r

这篇文章这个链接之后,我尝试更新我的R版本.

 sessionInfo()
 R version 2.14.0 (2011-10-31)
 Platform: i386-pc-mingw32/i386 (32-bit)

 locale:
 [1] LC_COLLATE=English_United States.1252 
 [2] LC_CTYPE=English_United States.1252   
 [3] LC_MONETARY=English_United States.1252
 [4] LC_NUMERIC=C                          
 [5] LC_TIME=English_United States.1252    

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

 other attached packages:
 [1] installr_0.9

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

但是当我运行代码时

  updateR()
  Error in file(con, "r") : cannot open the connection
Run Code Online (Sandbox Code Playgroud)

它在运行以下命令时显示完全相同的错误:

 check.for.updates.R() # tells you if there is a new version of R or not.
 Error in file(con, "r") : cannot open the connection

 install.R() # download and run the latest R installer
 Error in file(con, "r") : cannot open the connection
Run Code Online (Sandbox Code Playgroud)

如何更新我的R版本?

小智 36

根据https://github.com/talgalili/installr/#troubleshooting,

试试跑步:

setInternet2(TRUE)
Run Code Online (Sandbox Code Playgroud)

当我收到以下错误消息时,这对我有用:

文件错误(con,"r"):无法打开连接

  • 从3.2.1更新到3.2.2时,此解决方案首次适用于我. (3认同)

mat*_*fee 3

该包的 URLinstallr可能已过时。只需访问 R 网站并下载最新版本即可。

不过,您必须手动重新安装软件包,这可能会很痛苦。您可以rownames(installed.packages())在旧 R 中使用来获取当前已安装的软件包列表,这样当您转到新 R 时,您可以沿着列表进行操作并再次安装它们。

你甚至可以这样做

sprintf('install.packages(%s)', paste(shQuote(rownames(installed.packages())),collapse=','))
Run Code Online (Sandbox Code Playgroud)

然后将该命令复制粘贴到您的新 R 中,尝试重新安装您在旧 R 上安装的所有内容。我个人更喜欢在需要时安装它们,这样如果我有软件包,我就不再在旧 R 中使用,除非我需要它们,否则我不会费心在新的 R 上重新安装它们。

此外,上述操作可能会失败,因为您当前的 R 与新 R 相比相当旧,因此某些软件包可能不再兼容。