Skip to content

Using R Studio via OnDemand

R Studio is a code development environment for R. It provides an intuitive web interface for developing your R workflow interactively. Using R Studio on Apocrita via OnDemand allows you to scale to much larger datasets and workloads without putting a strain on your local machine. Please refer to the overview section for instructions on how to login to OnDemand.

Starting an R Studio session

Select R Studio Server from the Servers list of the Interactive Apps drop-down menu, or from the My Interactive Sessions page.

Choose the resources your job will need. Choosing a 1 hour maximum running time is the best option for getting a session quickly, unless you have access to owned nodes which may offer sessions immediately for up to 240hrs if resources are available.

Request 1 core for most R Studio jobs

In most cases, R Studio will only use 1 core, therefore any additional cores requested will be allocated but not utilised.

R studio resources

Once clicking Launch, the request will be queued, and when resources have been allocated, you will be presented with the option to connect to the session by clicking on the blue Connect to R Studio Server button.

Once connected, the familiar R Studio interface is presented, and you will be able to use the allocated resources, and access your research data located on Apocrita.

R Studio session

Installing packages

It's likely your scripts will require additional R libraries; these can be installed using the install.packages() command in the console window of R Studio. If the package cannot be installed due to missing dependencies, please contact us and we will try to add them to the container that R Studio runs from.

Known issues

Web browser security

For security reasons, modern browsers will restrict OnDemand from embedding certain content in the R Studio application. When this occurs, you will be prompted to view the content in a new window instead.

R Shiny embedding

Rproject

If you use the Rproject feature of R Studio, you need to make sure that you uncheck the "Automatically activate project-local Python environments" checkbox in "Global Options" ("Tools > Global Options") under the "Python" tab on the left:

Global Options Python

This is enabled by default, and it modifies your $PATH environment variable, meaning that any modules required for your session, including key modules such as GCC, won't load correctly.

Exiting the session

If a session exceeds the requested running time, it will be killed. You may receive a message "The previous R session was abnormally terminated...". Click OK to acknowledge the message and continue. To avoid this message, it's good practice to exit the session cleanly when you have finished.

To cleanly exit R Studio, click File -> Quit Session... and then release resources back to the cluster queues by clicking the red Delete button for the relevant session on the My Interactive Sessions page.