Rya*_*tic 270
为了完整起见,答案是:你不能在RStudio中做到这一点.@agstudy说得对 - 你需要安装较新版本的R,然后重新启动RStudio,它会自动使用新版本,正如@Brandon所说.
如果有一个update.R()函数会很好,类似于install.packages()函数或update.packages(函数).
好吧,我使用Mac,所以我只能为Mac提供准确的细节 - 也许其他人可以为windows/linux提供准确的路径; 我相信这个过程是一样的.
为了确保您的软件包能够使用闪亮的新版R,您需要:
将包从旧R安装移动到新版本; 在Mac OSX上,这意味着从这里移动所有文件夹:
/Library/Frameworks/R.framework/Versions/2.15/Resources/library
Run Code Online (Sandbox Code Playgroud)
到这里:
/Library/Frameworks/R.framework/Versions/3.0/Resources/library
Run Code Online (Sandbox Code Playgroud)
[无论您升级到哪个版本,都将替换"2.15"和"3.0".并且只复制目标目录中尚未包含的任何包.也就是说,不要用你的旧包覆盖你的新'基础'包 - 如果你这样做了,不要担心,我们会在下一步修复它.如果这些路径不适合您,请尝试使用installed.packages()
以查找正确的路径名.]
现在,您可以通过键入update.packages()
RStudio控制台来更新您的软件包,并回答所有提示的"y".
> 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---
Run Code Online (Sandbox Code Playgroud)最后,为了让自己放心,你已经完成了所有工作,在RStudio控制台中键入这两个命令,看看你得到了什么:
> version
> packageStatus()
Run Code Online (Sandbox Code Playgroud)ags*_*udy 129
您从安装R的新版本的官方网站.
重新启动时,RStudio应自动从新版本开始.
如果你需要手动完成,在RStudio中,请转到:工具 - >选项 - >常规.
查看@ micstr的答案以获得更详细的演练.
Jam*_*ers 111
如果您使用的是Windows,则可以使用installr.这里使用示例
Bor*_*lis 58
我会建议使用Windows包installr做到这一点.软件包不仅会更新您的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.
Run Code Online (Sandbox Code Playgroud)
jro*_*las 43
如果您使用的是Mac计算机,则可以使用新的updateR软件包从RStudio更新R版本:http://www.andreacirillo.com/2018/02/10/updater-package-update-r-version- 与-A-功能上-MAC-OSX /
总之,您需要执行以下操作:
要使用updateR从Rstudio中更新R版本,您只需运行以下五行代码:
Run Code Online (Sandbox Code Playgroud)install.packages('devtools') #assuming it is not already installed library(devtools) install_github('andreacirilloac/updateR') library(updateR) updateR(admin_password = 'Admin user password')
在安装过程结束时,一条消息将确认您的快乐结束:
Run Code Online (Sandbox Code Playgroud)everything went smoothly open a Terminal session and run 'R' to assert that latest version was installed
Car*_*and 11
将其粘贴到控制台并运行命令:
## 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.
Run Code Online (Sandbox Code Playgroud)
有一个名为installr的新软件包可以在Windows平台上更新R中的R版本.该软件包是在3.2.3版本下构建的
从R Studio中,单击Tools并选择Install Packages ...然后键入名称"installr"并单击install.或者,您可以在控制台中键入install.packages("installr").
一旦R studio完成安装包,通过在控制台中键入require(installr)来加载它.
要开始R安装的更新过程,请键入updateR().此功能将检查R的较新版本,如果可用,它将指导您完成所需的决策.如果您的R安装是最新的,它将返回FALSE.
如果您选择下载并安装较新版本.有一个选项可以将所有软件包从当前的R安装复制/移动到更新的R安装,非常方便.
更新过程结束后退出并重新启动R Studio.R Studio将加载较新的R版本.
如果您想了解有关如何使用installr软件包的更多信息,请点击此链接.
归档时间: |
|
查看次数: |
434932 次 |
最近记录: |