如何通过RStudio更新R ?
当前回答
将其粘贴到控制台并运行命令:
## How to update R in RStudio using installr package (for Windows)
## paste this into the console and run the commands
## "The updateR() command performs the following: finding the latest R version, downloading it, running the installer, deleting the installation file, copy and updating old packages to the new R installation."
## more info here: https://cran.r-project.org/web/packages/installr/index.html
install.packages("installr")
library(installr)
updateR()
## Watch for small pop up windows. There will be many questions and they don't always pop to the front.
## Note: It warns that it might work better in Rgui but I did it in Rstudio and it worked just fine.
其他回答
如果您使用的是windows,则可以使用安装程序。 示例用法
如果你使用的是Mac电脑,你可以使用新的updateR包从RStudio更新R版本:http://www.andreacirillo.com/2018/02/10/updater-package-update-r-version-with-a-function-on-mac-osx/
总之,您需要执行以下操作:
要在Rstudio中使用updateR更新你的R版本,你只需要运行这五行代码: Install.packages ('devtools') #假设尚未安装 库(devtools) install_github (andreacirilloac /更新) 库(更新) updateR(admin_password = 'Admin用户密码') 在安装过程结束时,一条消息将确认你的幸福结局: 一切都很顺利 打开一个Terminal会话并运行'R'来断言已经安装了最新版本
将其粘贴到控制台并运行命令:
## How to update R in RStudio using installr package (for Windows)
## paste this into the console and run the commands
## "The updateR() command performs the following: finding the latest R version, downloading it, running the installer, deleting the installation file, copy and updating old packages to the new R installation."
## more info here: https://cran.r-project.org/web/packages/installr/index.html
install.packages("installr")
library(installr)
updateR()
## Watch for small pop up windows. There will be many questions and they don't always pop to the front.
## Note: It warns that it might work better in Rgui but I did it in Rstudio and it worked just fine.
您可以从官方网站上安装一个新版本的R。
当您重新启动RStudio时,它将自动以新版本启动。
如果您需要手动执行,在RStudio中,请转到:工具->选项->通用。
查看@micstr的答案,了解更详细的攻略。
我建议使用Windows包安装程序来完成这个任务。这个包不仅会更新您的R版本,而且还会复制和更新所有的包。这里有一个关于这个主题的博客。只需在R Studio中运行以下命令,并按照提示执行:
# installing/loading the package:
if(!require(installr)) {
install.packages("installr"); require(installr)} #load / install+load installr
# using the package:
updateR() # this will start the updating process of your R installation. It will check for newer versions, and if one is available, will guide you through the decisions you'd need to make.