Installing RStudio on your Virtual Machine

RStudio is an integrated development environment for the R programming language. RStudio makes using R easier, as it includes a console, code editor, tools for plotting and other features useful for development and debugging.

In this article, we will show you how to install RStudio on your Virtual Machine in the Aridhia DRE Workspace. Please note that RStudio is also available as a Built-in App in your workspace.

Instructions for Linux

Instructions for Windows

rstudio_interface.png

Installing RStudio on Linux

1. Check if R is installed

Once connected to the Linux Virtual Machine, open the terminal and run R.

This should open the R console. If you get an error, then follow the instructions for installing R first.

2. Download RStudio

Open your browser and navigate to the RStudio download page. Download the latest Ubuntu 18/Debian 10  *.deb package.

linux_rstudio_download.png

3. Install RStudio

First, you need to update the system:

sudo apt update && sudo apt upgrade -y

Then, cd into the Downloads folder and install the previously downloaded RStudio package (you might need to change the file name).

cd Downloads/
sudo apt install ./rstudio-1.3.1093-amd64.deb -y

4. Open RStudio

Once the installation is complete, you can open RStudio by typing the following command in the terminal:

rstudio

Alternatively, you can also open RStudio by going into Applications -> Development. Here you should see the RStudio icon.

rstudio_find.png

5. Optional: customize the look of your RStudio

Once in RStudio, in the top toolbar go into Tools -> Global Options and then select the Appearance tab. Here you can change the editor theme, font and other RStudio appearance features. If you like dark IDE themes, we recommend you try Cobalt or Monokai themes. Click 'Apply' to save your changes.

rstudio_theme.png

6. Optional: change R version

On Linux, RStudio uses the version of R pointed out by the which R command output.

If you have multiple versions of R installed, and want to override which version of R is used then you need to edit the .bashrc file:

sudo nano ~/.bashrc

This will open the nano editor in the terminal. Scroll down to the bottom of the file and add this line replacing the RSTUDIO_WHICH_R environment variable with the path of the R executable that you want RStudio to run:

export RSTUDIO_WHICH_R=/usr/local/bin/R

Click Ctrl+S and Ctrl+X to save and exit the file.

r_version_linux.png

Installing RStudio on Windows

1. Check if R is installed

Once connected to the Windows Virtual Machine, check if there is an R icon on the desktop. If not, then click on the 'Start menu' and scroll through the programs. See if R appears in the list.

If R is not installed on your Windows machine, then follow the instructions for installing R first.

2. Download RStudio installer

Open the browser and navigate to the RStudio Desktop download page. Download the executable for Windows 10/8/7.

windows_rstudio.png

By default, this will download the latest RStudio Desktop version, if you need an older one, you can download it from here.

3. Install RStudio

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

4. Open RStudio

Once the installation is complete, you can open RStudio by going into the Start menu. Here you should see the RStudio icon.

5. Recommended: install Rtools

We also recommend installing Rtools as this software is required for building and installing R packages from source code.

If you are using R 4.x version, then download Rtools40 installer from here. If you are using an older R 3.x version, then download Rtools installer from here.

Follow the instructions to complete the installation, accepting the defaults. Once the installation is finished, close and reopen RStudio. In the R console, run:

Sys.getenv('PATH')

You should see C:\rtools40\usr\bin; listed as one of the output variables.

rtools_verify.png

6. Optional: customize the look of your RStudio

Once in RStudio, in the top toolbar go into Tools -> Global Options and then select the Appearance tab. Here you can change the editor theme, font and other RStudio appearance features. If you like dark IDE themes, we recommend you try Cobalt or Monokai themes. Click 'Apply' to save your changes.

rstudio_theme.png

7. Optional: change R version

On Windows, the RStudio uses the system's current version of R by default. You can override which version of R is used by clicking Tools -> Global Options...

This will open the options dialog. In the General tab, you can select which version do you want RStudio to run. For changes to take effect, you will need to restart RStudio.change R version

r_version.png

Updated on October 9, 2023

Was this article helpful?