Skip to content

RStudio on Bianca

RStudio on Bianca

Introduction

RStudio is an IDE specialized for the R programming language.

What is an IDE?

See the page on IDEs.

In this session, we show how to use RStudio on Bianca, using Bianca's remote desktop environment.

Forgot how to login to a remote desktop environment?

See the 'Logging in to Bianca' page.

Spoiler: go to https://bianca.uppmax.uu.se/

As RStudio is a resource-heavy program, it must be run on an interactive node.

Forgot how to start an interactive node?

See the 'Starting an interactive node' page.

Procedure to start RStudio

Below is a step-by-step procedure to start RStudio on Bianca.

Prefer a video?

This procedure is also demonstrated in this YouTube video.

1. Get within SUNET

Forgot how to get within SUNET?

See the 'get inside the university networks' page here

2. Start the Bianca remote desktop environment

Forgot how to start Bianca's remote desktop environment?

See the 'Logging in to Bianca' page.

3. Start an interactive session

Within the Bianca remote desktop environment, start a terminal. Within that terminal, start an interactive node with 2 cores:

Why two cores?

RStudio is a resource-heavy program. Due to this, we recommend using at least two cores for a more pleasant user experience.

interactive -A [project_number] -n 2 -t 8:00:00

Where [project_number] is your UPPMAX project, for example:

interactive -A sens2016001 -n 2 -t 8:00:00
What is my UPPMAX project number?

Easy answers that is probably true:

The one you used to login, which is part of your prompt. For example, in the prompt below, the project is sens2016001.

[sven@sens2016001-bianca sven]$

Do not start RStudio from the menus

You can start a version of RStudio from the menus. However, this will not have access to loaded modules.

Instead, load RStudio from the module system instead.

4. Load the modules needed

In the terminal of the interactive session, do:

module load R_packages/4.3.1 RStudio/2023.12.1-402
Do all combinations of R_packages and RStudio work?

No.

Not all combination of R_packages and RStudio work equally well, but this one is known to work (as it was used in this solved ticket).

There have been issues using RStudio/2023.06.2-561 together with R/4.3.1

Shouldn't I load R first?

No.

Loading R_packages will load the corresponding R module.

What happens if I do not load R_packages?

Then you will have RStudio running without any R packages installed

5. Start RStudio

With the modules loaded, start RStudio from the terminal (on the interactive node):

rstudio

RStudio can be slow to startup, as R has thousands (!) of packages. Additionally, at startup and if enabled, your saved RStudio workspace (with potentially a lot of data!) is read.

How does RStudio look on Bianca?

RStudio when starting up:

RStudio when starting up

RStudio when started up:

RStudio when started up

RStudio in action:

RStudio in action

The RStudio debugger, at the error message level:

The RStudio debugger, at the error message level

The RStudio debugger, at the function-that-caused-the-error level:

The RStudio debugger, at the function-that-caused-the-error level

The RStudio debugger, at the program level:

The RStudio debugger, at the program level

Troubleshooting

RStudio freezes when I start it, where yesterday it still worked

Hypothesis: Your home folder is full

Your home folder is full. That explains why it still worked yesterday: at that day, your home folder was not full yet.

RStudio uses your home folder to store the things it needs, so when it is full, it cannot do its things.

To confirm, from a terminal do:

du -h -d 1 .

This will show how much space the folders in your home folder take:

Home folder of a user that had RStudio frozen

In this example, there is a folder called wharf_backup that is 4.5 gigabyte. Moving it to a project folder solved the problem:

mv wharf_backup/ /proj/nobackup/[your_project_folder] 

For example:

mv wharf_backup/ /proj/nobackup/sens2016001