Skip to content

RStudio: using it

You should then have the following page:

RStudio page

This should be the standard RStudio presentation.

You can note in the bottom, right panel, that all your folders (home, work, and save) are accessible. Your home being the default folder, we suggest that you change the RStudio working directory to your work (or project) folder. If you have a renv virtual environment set up in one of your project directory, set the working directory as this project directory (or create/open an RStudio project located in this directory) and restart your R session: this will automatically launch your environment.

This tutorial will not teach you how to use RStudio, but using R is one of the trainings provided by the GenoToul-biostat platform.

Packages

It is strongly advised that you install the packages directly login to genobioinfo cluster, and not when using RStudio: first, installing a package can take a long time and waste your time in the RStudio session. Second, packages installed from the cluster are all available in RStudio, provided that you have used the proper R version to install them. As a rule of thumb, please restrict the use of RStudio to your analyses.

In order to install your packages, please use the standard way to connect to the cluster (using SSH through the command line). You should use the same R version as the RStudio: 4.2.2.

So, if you want to install the package MASS (for example), please connect in command line, then type:

$ srun -t 10:00 --pty bash               # Use a node for 10 minutes
$ module load compilers/gcc/11.2.0       # Compulsory for R 4.2.2
$ module load statistics/R/4.2.2         # Load R
$ R                                      # Start R
> install.packages("MASS")               # Install the package

Bioconductor packages are installed by first installing the CRAN package BiocManager and then using (within R):

BiocManager::install("edgeR")

So far, it is possible that some packages installed in the command line can not be properly loaded in RStudio. If so, please refrain from installing the packages in RStudio, and contact the platform instead, in order to notify the problem.

Error "disk or database is full" or "Failed writing received data to disk/application"

When you get such errors in your R session (for instance because you are using functions that query external databases, like the function of the Bioconductor package clusterProfiler), it means that R is trying to write in the default temporary directory which has a very limited space within your RStudio session. This can be solved by:

  1. from the cluster command line, creating a directory tmp in your work directory (/work/user/LOGIN/tmp)
  2. creating and editing a file .Renviron in your home directory (or in your RStudio project directory) with the following line:

    $ TMP="/work/user/LOGIN/tmp"

where LOGIN has to be replaced by your login. 3. restarting your R session from RStudio.