Skip to content
hero
Matthias Zytnicki

RStudio: Use 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 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.