Rtist
Rtist

Reputation: 4205

How to automatically update R to the latest version?

I am posting this issue here as I suppose it bothered many R users. It is recommended to update R and packages as frequently as possible (see https://community.rstudio.com/t/should-i-update-all-my-r-packages-frequently-yes-no-why/5856). Yet, this can be time consuming to look if your version is the latest one, download the last version of R and reinstall all your packages.

Recently I discovered the installr package. It provided the very nice function updateR(). According to the documentation, the updateR() function performs the following: finding the latest R version, downloading it, running the installer, deleting the installation file, copy and updating old packages to the new R installation

Thanks to this post: How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?

Upvotes: 6

Views: 21049

Answers (2)

BerriJ
BerriJ

Reputation: 1019

If you're using Mac or Linux you can use a package manager for that.

On Mac you can use brew. On Linux it depends on your distribution. Most ditros ship with a default package manager. On Manjaro it's pamac. This approach has the advantage that it lets you automatically update all programs which you obtained using the package manager and not just R.

Upvotes: 3

KApril
KApril

Reputation: 690

Windows To update R on Windows, try using the package installr (only for Windows)

Install and load installr: install.packages("installr") and library(installr) Call updateR() function. This will start the updating process of your R installation by: “finding the latest R version, downloading it, running the installer, deleting the installation file, copy and updating old packages to the new R installation.” From within RStudio, go to Help > Check for Updates to install newer version of RStudio (if available, optional). You are ready for Data Science Essentials for R!

Mac On Mac, you can simply download and install the newest version of R. When you restart RStudio, it will use the updated version of R.

Go to https://cloud.r-project.org/bin/macosx/ Click the link “R-3.5.2.pkg” When the file finishes downloading, double-click to install. You should be able to click “Next” to all dialogs to finish the installation. From within RStudio, go to Help > Check for Updates to install newer version of RStudio (if available, optional). To update packages, go to Tools > Check for Package Updates. If updates are available, select All (or just tidyverse), and click Install Updates. You are ready for Data Science Essentials for R!

For more details see below link https://uvastatlab.github.io/phdplus/installR.html

Upvotes: 5

Related Questions