Step 1 : Add the repository
The version of R in the default repository is old. To get the latest version of R, we will have to add a new repository to the package manager.
$ codename=$(lsb_release -c -s) $ echo "## R repository" | sudo tee -a /etc/apt/sources.list > /dev/null $ echo "deb https://cran.rstudio.com/bin/linux/ubuntu/ $codename/" | sudo tee -a /etc/apt/sources.list > /dev/null $ sudo apt-get update
Step 2 : Install r-base
Now that the repository is setup, you can install R.
$ sudo apt-get install r-base
During this step, you might get a warning since the repository's keys are not on the servers.
Step 3 : Try R
As usual, we will try R with a "Hello World". Open a terminal and do the following :
$ R > print('Hello World!');  "Hello World!"
Step 4 : Install RStudio
There are no version of RStudio in Ubuntu repositories. So to install it, you will need to download it and install it manually.
$ cd ~/Téléchargements/ $ wget https://download1.rstudio.org/rstudio-0.99.484-amd64.deb
A deb file can be installed using
$ dpkg -i rstudio-0.99.484-amd64.deb
During this last step, you might get a message saying that you are missing a dependencies. The installation will work anyway, but you should install the packages.
$ sudo apt-get install <missing-package>