Running R


Marie-Hélène Burle

This section covers the various ways R can be run, then shows you how to access our temporary RStudio server for this course.

Running R

R being an interpreted language, it can be run non-interactively or interactively.

Running R non-interactively

If you write code in a text file (called a script), you can then execute it with:

Rscript my_script.R

The command to execute scripts is Rscript rather than R.
By convention, R scripts take the extension .R.

Running R interactively

There are several ways to run R interactively.

  • Directly in the console (the name for the R shell):


The RStudio IDE is popular and this is what we will use today. RStudio can can be run locally, but for this course, we will use an RStudio server.

Accessing our RStudio server

You do not need to install anything on your machine for this course as we will provide access to a temporary RStudio server.

A username, a password, and the URL of the RStudio server will be given to you during the workshop.

Sign in using the username and password you will be given while ignoring the OTP entry. This will take you to the server options page of a JupyterHub.

Select the following server options:

  • Time: 4 hours
  • Number of cores: 1
  • Memory: 3700 MB
  • User interface: JupyterLab

Then press “Start” to launch the JupyterHub. There, click on the “RStudio” button and the RStudio server will open in a new tab.

Note that this temporary cluster will only be available for the duration of this course.

Using RStudio

For those unfamiliar with the RStudio IDE, you can download the following cheatsheet: