Basic information extracted from The Comprehensive R Archive Network webiste.
The packages you need to run R on Ubuntu are available in the Ubuntu repositories, but updated only for each LTS release. If you want to keep R up to date, you will need to install the Launchpad PPA repository. I selected a mirror from the CRAN mirrors website.
These Ubuntu archives are also available on CRAN, but these are signed with the key of “Michael Rutter firstname.lastname@example.org” with key ID E084DAB9. If you decide to use the archives on CRAN, you first need to add the key to your system.
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
$ sudo deb http://cran.rstudio.com/bin/linux/ubuntu xenial/
OR… use a mirror
$ sudo deb https://mirrors.nic.cz/R/bin/linux/ubuntu xenial/
Retrieve the updated package lists
$ sudo apt-get update
Install the packages
$ sudo apt-get install r-base
Users who need to compile R packages from source [e.g. package maintainers, or anyone installing packages with install.packages()] should also install the r-base-dev package:
$ sudo apt-get install r-base-dev