在Rstudio中更新R
install.packages("installr")
library(installr)
updateR()
出现下列错误
> updateR()
Error in file(con, "r") : 无法打开链结
此外: Warning message:
In file(con, "r") : InternetOpenUrl失败:’操作超时'
好像是因为镜像在国内的问题,所以加个镜像链接
updateR(fast=TRUE,cran_mirror="https://mirrors.ustc.edu.cn/CRAN/")
于是就成功了
> updateR(fast=TRUE,cran_mirror="https://mirrors.ustc.edu.cn/CRAN/")
There is a newer version of R for you to download!
You are using R version: 4.0.2 (2020-06-22)
And the latest R version is: 4.0.3 (2020-10-10)
------------------------
It is best to run 'updateR()' from Rgui and not from RStudio. Would you like to abort the installation and run it again from RGui?
1: Yes
2: No
Selection: 2
这里在问是否要选择在Rgui里更新,选是的话需要在Rgui里重新更新,而选否可以直接更新,所以当然毫不犹豫选个2,出错再说!
选完过一会儿会有安装程序自启动,就按照官网下载安装步骤,下一步下一步下一步就ok
Installing the newest version of R,
please wait for the installer file to be download and executed.
Be sure to click 'next' as needed...
试开URL’https://mirrors.ustc.edu.cn/CRAN/bin/windows/base/R-4.0.3-win.exe'
Content type 'application/octet-stream' length 88237960 bytes (84.2 MB)
downloaded 84.2 MB
The file was downloaded successfully into:
C:\Users\Lenovo\AppData\Local\Temp\RtmpUlSTeZ/R-4.0.3-win.exe
Running the installer now...
-----------------------
I am now copying 138 packages from: D:/R/R-4.0.2/library ; into: D:/R/R-4.0.3/library-----------------------
=====================
Done. We finished copying all the packages to the new location
[1] TRUE
看样子是更新好了
在global options里选择新的版本,再重新启动。
成功换新。
在Rstudio里安装就是不用重装包,方便多了。