旧版
可以直接在R studio 中下载新版本的R。
但是mac 不像windows,可以很方便的进行R 的版本控制。
因此使用installr 包中的updateR 函数,查了下教程:
install.packages("installr")
library(installr)
updateR()
发现这个包不在,找了一下,发布在github 上:
remotes::install_github("andreacirilloac/updateR")
发现还是下载的好慢啊,简直龟速!
那就尝试自行下载R 本地安装:https://www.yuque.com/mugpeng/rr/kkz6pg
把项目下载到R 环境中,直接安装:
> install.packages("updateR-master", repos=NULL, type="source")
好的很:
> library(updateR)
A new version R of 4.0.3 is available for update!
run updateR() to get the latest R on your macOS!
> updateR()
Enter password for appe:
孩子哭了:
Updated ~/.Rprofile
Password:错误: Latest R Version 4.0.3 requires macOS at least 10.13 or higher,
but 10.12 is running. Consider upgrading macOS or install legacy R binaries from
http://cran.rstudio.com/bin/macosx/
我sierra 永不为奴!!
新版
到头来还是真香了:
发现网上有人使用的是installr(我们下载的包也叫updateR) 中的函数:
updateR(fast=TRUE,cran_mirror="https://mirrors.ustc.edu.cn/CRAN/")
但读了一下updateR 这个包,发现其并不能设置镜像,而且竟然还是只能在mac os 上使用。
查看了一下,发现updateR 和installr 这两个包分别对应了win os 与mac os 的两个系统。
在win os 中,installr 还提供了copy.packages.between.libraries
包实现迁移。
而且在我的电脑上,updateR 无关顺利完成更新,而且其也无法设置镜像,完成更新后只不过下载了一个新版本的R 罢了!
再试试看手动下载R 和手动迁移包吧。有个方法:https://stackoverflow.com/questions/13656699/update-r-using-rstudio
关于新旧迁移,直接参见: