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.
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…
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.
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.
Merry Wooden Christmas Tree!