如何通过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.
其他回答
您可以从官方网站上安装一个新版本的R。
当您重新启动RStudio时,它将自动以新版本启动。
如果您需要手动执行,在RStudio中,请转到:工具->选项->通用。
查看@micstr的答案,了解更详细的攻略。
在安装R的新版本后,只需重新启动R Studio。要确认您使用的是>版本的新版本,您应该会看到新的详细信息。
我发现对我来说,在Linux下保持最新状态的最佳永久解决方案是安装r补丁项目。这将使你的R安装保持最新,你甚至不需要在安装之间移动你的包(这在RyanStochastic的回答中有描述)。
对于openSUSE,请参见此处的说明。
为了完整起见,答案是:您不能从RStudio内部完成该操作。@agstudy是正确的-你需要安装新的R版本,然后重新启动RStudio,它会自动神奇地使用新版本,正如@Brandon指出的那样。
如果有一个update.R()函数,类似于install.packages()函数或update.packages(函数),那就太好了。
为了安装R,
登录http://www.r-project.org, 点击“CRAN”, 然后选择你喜欢的CRAN网站。我喜欢堪萨斯州:http://rweb.quant.ku.edu/cran/。 点击“下载R for XXX”[其中XXX是你的操作系统] 遵循操作系统的安装过程 重启RStudio 喜乐
等等——那我心爱的包裹怎么办??--
好吧,我使用的是Mac,所以我只能提供Mac的准确细节-也许其他人可以提供windows/linux的准确路径;我相信这个过程是一样的。
为了确保你的包能与R的新版本兼容,你需要:
move the packages from the old R installation into the new version; on Mac OSX, this means moving all folders from here: /Library/Frameworks/R.framework/Versions/2.15/Resources/library to here: /Library/Frameworks/R.framework/Versions/3.0/Resources/library [where you'll replace "2.15" and "3.0" with whatever versions you're upgrading from and to. And only copy whatever packages aren't already in the destination directory. i.e. don't overwrite your new 'base' package with your old one - if you did, don't worry, we'll fix it in the next step anyway. If those paths don't work for you, try using installed.packages() to find the proper pathnames.] now you can update your packages by typing update.packages() in your RStudio console, and answering 'y' to all of the prompts. > update.packages(checkBuilt=TRUE) class : Version 7.3-7 installed in /Library/Frameworks/R.framework/Versions/3.0/Resources/library Version 7.3-8 available at http://cran.rstudio.com Update (y/N/c)? y ---etc--- finally, to reassure yourself that you have done everything, type these two commands in the RStudio console to see what you have got: > version > packageStatus()
将其粘贴到控制台并运行命令:
## 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.