How To Change Version Of R In Rstudio
When was the last fourth dimension y'all update your R and RStudio?
I installed RStudio and R a yr ago, and never update it since then. Today I just noticed I cannot install new R packages because of my old R version. And so I explore some means to update R and would like to share with someone who is too looking to update R on RStudio.
The problem
RStudio and R cannot update on their own because some packages may non piece of work after switching to the new version (Yous can still downgrade R version in RStudio if something went wrong though). After you install the new version, the previously installed packages will not get to next version. And so it is required actress procedures to move the packages.
Here are iii means you can update R version in RStudio. Note that nosotros demand to move the install R packages, which I volition prove how at the end.
three Solutions to update R on RStudio
Solution 1) Manually install (Recommended if yous don't care nigh the old packages)
The first method is to download a new version of R from R website > CRAN. Then restart your RStudio. The new R version will be loaded automatically.
The new R version announced right later on I install R and restart RStudio
Update 29/05/2019: For Mac users, solution iii is also painful and not working well for me. This method is fast and working well. I would recommend to save your time from headache and apply this method. Have note of your previous packages so you lot can install them again as needed.
Solution 2) Windows only – use installr
installr is the R package which helps install and update software.
The R code y'all will need for updating R is: (credit goes to Cara Wogsland for the code)
install.packages("installr")
library(installr)
updateR()
You can discover the tutorial on how to use installr to update RStudio on R-Statistics website.
Solution 3) Mac only – use updateR
Similar to installr, updateR is the package to aid updating R on Mac OS.
The R lawmaking you will need is these 5 lines: (credit goes to jroberayalas for the lawmaking)
install.packages('devtools') #assuming it is not already installed
library(devtools)
install_github('andreacirilloac/updateR')
library(updateR)
updateR(admin_password = 'Admin user password')
You can discover in-depth tutorial on how to apply updateR packet on this web log.
How to move the previously installed R packages
This is the instructions for Mac Os user (who used solution 1 or 3 above). For Windows user,installr package volition practise this for you lot
(credit goes to RyanStochastic and micstr):
1. Move all folders from your old R version to new R version.
/Library/Frameworks/R.framework/Versions/ten.xx/Resources/library
Replace x.xx with the quondam and new R version at a time.
Note that you have to move but the packages that are not currently in the destination binder (because those are the base packages, and you don't desire to ruin them). Only if you already did replaced everything, the next step will solve this for you.
If you cannot detect the proper path, you can run this command to bank check:installed.packages()
2. Update the moved packages
Run the post-obit control in R. Type 'y' for every question that popped up.
update.packages(checkBuilt=TRUE)
3. Type the following command in R to check if everything went well
version
packageStatus()
That's it! Hope you guys success in updating R. If not, please check in the reference link beneath.
References: https://stackoverflow.com/questions/13656699/update-r-using-rstudio
Source: https://www.linkedin.com/pulse/3-methods-update-r-rstudio-windows-mac-woratana-ngarmtrakulchol
Posted by: williscappiket.blogspot.com
0 Response to "How To Change Version Of R In Rstudio"
Post a Comment