How to upgrade R in linux?
Asked Answered
D

2

30

I am new to Linux. I am using Linux mint 18.1. I have installed R using system software manager. My current R version is 3.2. But I want to upgrade it to version 3.4.

How can I do it?

Didi answered 14/9, 2017 at 8:24 Comment(2)
github.com/lmmx/devnotes/wiki/Updating-R-on-LinuxCleavable
See also here for an answer using bash and Debian; should be simple enough to adapt to mint. https://mcmap.net/q/101069/-painless-way-to-install-a-new-version-of-rDissolve
C
48

Note: I now keep on GitHub (here) an up-to-date guide to upgrading R on Linux Mint or Ubuntu Linux, which also includes a bit of extra information about system dependencies for tidyverse, the popular set of data-wrangling packages, as well as devtools, the popular R package development... package.


The link provided by FedRo is a good resource, however a slight change would need to be made since you're using Linux Mint 18.1 which uses Xenial repositories rather than Trusty repositories (see here). I also typically use the approach here to deal with packages I've already installed when I upgrade R rather than the approach offered by FedRo. So, for completeness, these are all the steps you'd need to take:

Step 1

Go to CRAN's list of mirrors and find the URL of the mirror that is closest to you. The terminal commands below assume you choose http://cran.wustl.edu/

Step 2

Open a terminal and enter the following commands1 (replacing http://cran.wustl.edu/ with whichever CRAN mirror URL you chose in step 1):

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo echo "deb http://cran.wustl.edu/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt upgrade r-base r-base-dev
sudo apt update
sudo apt upgrade

Note also that I have put to upgrade r-base and r-base-dev, but I don't know if you have r-base-dev installed. If not, I highly recommend you install it via sudo apt install r-base-dev.

Step 3

Start a new R session and run the following:

update.packages(checkBuilt=TRUE, ask=FALSE)

Then you should be good to go.

Update: Linux Mint 19 and R 3.6.x

Since both Linux Mint and R have seen upgrades since I answered this question, I'm updating for those who come to this answer needing the info for Linux Mint 19 and R 3.6.x.

The only difference is that instead of the command

sudo echo "deb http://cran.wustl.edu/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list

you need to use

sudo echo "deb http://cran.wustl.edu/bin/linux/ubuntu bionic-cran35/" | sudo tee -a /etc/apt/sources.list

(replacing http://cran.wustl.edu/ with whichever CRAN mirror URL you chose in step 1)


1 I put here the full key, though many other guides you may see will use only the "short key." I have updated this guide to use the full key out of security concerns (see here, for example).

Cannonry answered 14/9, 2017 at 10:26 Comment(0)
S
7

Now it is very simple. Just make:

install.packages("ropenblas")
ropenblas::rcompiler()
Sewell answered 17/12, 2020 at 15:0 Comment(2)
Hi, it appears to not be working on R 4.3.3. due to incorrect download urlIndispensable
Try ropenblas::rcompiler("4.3.3").Superhighway

© 2022 - 2024 — McMap. All rights reserved.