Updating R on Ubuntu

[This article was first published on R on datawookie, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Today I finally got around to updating my R to 3.5 (or, more specifically, 3.5.1). The complete instructions for doing the update on Ubuntu are available here. I’ve paraphrased them below.

Authentication Key

To ensure the integrity of files, add the appropriate public key to your system. You may have already done this, in which case you can skip this step.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

APT Sources

Edit /etc/apt/sources.list and add the line appropriate to your distribution of Ubuntu.

# 18.04
deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/
# 16.04
deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/
# 14.04
deb https://cloud.r-project.org/bin/linux/ubuntu trusty-cran35/

Update and Install

sudo apt-get update
sudo apt-get install r-base r-base-dev
#
# To update any R libraries installed via APT.
#
sudo apt-get upgrade

Remove System Packages

You will probably have some packages that were previously installed with using APT. It would make sense to get rid of these now and simply installed updated versions into your local library.

sudo apt-get remove -y 'r-cran-*'

Update Packages

Start the R interpreter and then update all installed packages. That will take a while, depending on the number of packages you have installed.

update.packages(ask = FALSE)

Almost all of my packages updated seamlessly using the above. However, there were a handful that I needed to install manually.

To leave a comment for the author, please follow the link and comment on their blog: R on datawookie.

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.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)