Amazon EC2: Upgrading R

After installing R and Shiny on my EC2 instance I discovered that the default version of R was a little dated and I wanted to update to R 3.2.0. It’s not terribly complicated, but here are the steps I took.

When you launch R you should find that it is the sparkling new version.

Now you will want to update all of the packages too, so launch R (as root) and then do:

update.packages(lib.loc = "/usr/local/lib/R/site-library", ask = FALSE)

If you have packages installed in a user library, you should update those too.

Finally, if you run into memory problems with the package updates, then you’ll need to add a swap file.