How do install package of R language's interpreter for statistical computing?

Package you are asking of is r-base. So run the following command:

sudo apt-get install r-base

and you will have R in your system. Years ago I was also confused by this - such package name is stupid indeed.


The package you want is r-base Install r-base.

If you need to build R packages from source, you also need r-base-dev Install r-base-dev. (Most users probably don't need this.)

That's likely all you need to do.

Getting newer versions of R

The version of R probably your Ubuntu release's official software sources is likely sufficient. Assuming that's the case, you needn't read any further (except perhaps for entertainment).

But if you want/need the latest version, choose a CRAN mirror from the list. The do one of the following:

  • Make a .list file (you might call it r.list) in /etc/apt/sources.list.d with this line as its contents:

    deb http://your-cran-mirror/bin/linux/ubuntu trusty/

    If you're using Ubuntu 14.04 Trusty Tahr, you'll keep trusty as it is. Otherwise replace that word with the lower-case codename of whatever Ubuntu release you're using. (The first word only; the "adjective", not the "animal name".) They are listed here or on the releases page. For example, for Ubuntu 12.04 Precise Pangolin it is precise. For 14.10 Utopic Unicorn it will be utopic.

    This is the name listed in most or all of the similar deb lines in the configuration file /etc/apt/sources.list.

    To make your r.list file, you can open a Terminal windows (Ctrl+Alt+T) and run a command like this (making sure to substitute in your CRAN mirror of choice, and, if you're not running 14.04, your release codename):

    echo 'deb http://your-cran-mirror/bin/linux/ubuntu trusty/' | sudo tee -a /etc/apt/sources.list.d/r.list

    For example, on an Ubuntu 15.04 Vivid Vervet system located in the northeastern United States, I used:

      echo 'deb http://cran.mirrors.hoobly.com/bin/linux/ubuntu vivid/' | sudo tee -a /etc/apt/sources.list.d/r.list
    
  • Or, instead of adding the software source in its own configuration file, add that line to the master software sources configuration file, /etc/apt/sources.list. You can open that file up in a graphical text editor by opening a Terminal window (Ctrl+Alt+T) and running the command:

      sudo -H gedit /etc/apt/sources.list
    

Add the signing key for the CRAN repositories (you can verify it here):

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

If that fails, this way may work:

gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -

To activate the new software sources configuration, run:

sudo apt-get update

Then to install (or upgrade to) the version of R for CRAN:

sudo apt-get install r-base

(You can install r-base-dev and any other needed packages similarly. sudo apt-get upgrade will typically upgrade any R packages that have newer versions, if an older version is installed; you don't have to enter their names individually.)

Further reading / source cited:

For more details and information about other supporting packages available for installation on Ubuntu systems, see "UBUNTU PACKAGES FOR R".

  • The above answer is (very) loosely adapted from (a small) part of that README.
  • The commands for importing the CRAN signing key are drawn directly from it, though my instructions are in my own words, and simplified.