1. Home
  2. Tools and Features
  3. Virtual Desktops
  4. Installing R on your Virtual Desktop

Installing R on your Virtual Desktop

R, together with Python, is a commonly used programming language for statistical computing and data analytics. An increasingly popular and extensible language with an active community, R offers many user-generated packages for specific areas of study, which makes it applicable to many fields.

The Aridhia DRE Workspace comes with R integrated into the workspace but if you want to use it in the VM, you will need to follow the instructions below to install it yourself.

Instructions for Linux

Instructions for Windows

Installing R on Ubuntu 18.04

1. Obtain the relevant GPG Key

Because the VM has restricted access to the Internet, you will need to do this step outside the Workspace, e.g. on your personal machine.

If you are running Linux, then you need to run these commands in your terminal:

gpg --keyserver keyserver.ubuntu.com --recv-key E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg -a --export E298A3A825C0D65DFD57CBB651716619E084DAB9 > E298A3A825C0D65DFD57CBB651716619E084DAB9.pub

This will obtain the CRAN GPG key and export it to a *.pub file.

If you are using Windows, then you need to obtain CRAN repository key from the Ubuntu Keyserver website. Open the link in your browser, right-click with your mouse and select 'Save as'. Name the key E298A3A825C0D65DFD57CBB651716619E084DAB9.pub.

2. Upload the GPG key to the Workspace

Upload the key to the workspace by going into the Add tab and pressing 'Upload File'. This will open a new dialog, where you can find the exported GPG key (*.pub file) in your local file system and upload it to the workspace. More information about uploading files can be found in the Uploading files via the Workspace page.

3. Add the CRAN GPG key to your system

Once the key is uploaded, go back to your Virtual Desktop and open the terminal. First, cd into the directory where your GPG key is:

cd files

Then add the CRAN GPG key to your system:

sudo apt-key add E298A3A825C0D65DFD57CBB651716619E084DAB9.pub

4. Enable the CRAN repository

For the latest R 4.x version use this command:

sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'

For the latest R 3.x version:

sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'

5. Update the packages list and install R

sudo apt update
sudo apt install r-base -y

6. Test that the right version of R has been installed

In the terminal, just run R. This should open the R console, and the first line of the text should display the version of R you are currently running.

Now you are ready to use R in your Linux VM. For a better development experience, we also recommend installing RStudio. You can find the instructions here

Installing R on Windows

1. Download R installer

Open the browser and navigate to cloud.r-project.org. Click ‘Download R for Windows’, which will open a new page with subdirectories. You will want to download binaries for base distribution, so click on ‘base’ subdirectory.

By clicking at the link at the top of the page, you will download the latest R distribution. If you want an older version, scroll down to the bottom of the page and navigate to ‘Previous Releases’.

2. Install R

Navigate to the Downloads folder, and double click on the executable. Follow the instructions to complete the installation.

Now you are ready to use R in your Windows VM. For a better development experience, we also recommend installing RStudio. You can find the instructions here

Updated on December 11, 2020

Was this article helpful?

Related Articles

Not the solution you were looking for?
Click the link below to submit a support ticket
CONTACT SERVICE DESK