Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
It’s that time again—time for a new R version! The latest version 3.2.3 “Wooden Christmas Tree” is a small upgrade for most, but a huge step for Windows users. Of the new features included in Wooden, half of them are Windows-specific.
Several months back I wrote a tutorial on how to upgrade R on a Mac without losing your packages, so in light of this new Windows-y version of R, I thought it would be fair to do the same for Windows.
Linux users have it easy, just a short terminal command and R is upgraded. Windows…well, not so much. It proved to be such a pain, a group created the installr package, just to deal with this task for the Windows OS.
Upgrade R with installr
First, you’ll need to grab the package off of CRAN or from the developer’s GitHub repo. In this case, I would suggest CRAN for maximum stability.
install.packages('installr')
The installr package has several options but one primary job, to update your version of R while maintaining all your packages and library locations. To do this you just…
library(installr) updateR()
The above function will:
1. Find and download the latest version of R.
2. Copy (or move) all of the packages from your current R install to the new one.
3. Erase all of your old packages (optionally).
4. Update your packages.
Each part of the updateR() function is broken down in to smaller functions, so if you just want to check for a new version and nothing else you can run the check.for.updates.R() function.
Common Error
When I did this upgrade on my Windows VM, I ran into the following error:
updateR() Error in file(con, "r") : cannot open the connection
Apparently this is pretty common for R on Windows, using the developer’s recommendation from the package’s markdown file, this cleared everything up.
setInternet2(TRUE)
Merry Wooden Christmas Tree!
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.