How-to: Using RStudio

How-to: Using RStudio

RStudio is an integrated development environment (IDE) for R. It includes a console, syntax-highlighting editor that supports direct code execution, as well as tools for plotting, history, debugging and workspace management. For more information, see https://www.rstudio.com/products/RStudio/

Accessing RStudio

LMM users

For your convenience, RStudio is running on lmm.its.albany.edu. To access it, log in with your UAlbany NetID and password: https://rstudio.its.albany.edu/. You may find your performance varies greatly using this method. See "Spawning on the General Purpose Cluster" below for information on how to use RStudio with dedicated resources.

Liska users

Log in with your UAlbany NetID and password: https://rstudio-liska.arcc.albany.edu/

Spawning on the General Purpose Cluster

You may experience varying performance on rstudio.arcc.albany.edu, but don't worry, you can run RStudio on the cluster!

 

  1. First SSH into head.its.albany.edu, you can follow the tutorial here: How-to: Connect via SSH (PuTTY, macOS terminal)

  2. Run the following command:

    cp /network/rit/misc/software/singularity/rstudio4.4.2.sbatch .
  3. Now you can edit this file with vim, gedit, emacs, etc to request the amount of resources you need. Follow the FAQ page How-to: Scheduling via SLURM to learn about some of the #SBATCH commands in the file.

  4. After changing the #SBATCH commands to suit your needs, run:

    sbatch ~/rstudio4.4.2.sbatch
  5. A log file will be generated in your home directory once your jobs spawns, following the naming convention rstudio_######.log, which documents how to connect to the server and kill the server when you are finished. Note that you must use the randomly generated password to log in

Using your own R Library

  1. Create a file in your home directory called .Renviron 

  2. Set R_LIBS_USER=/path/to/custom/R/lib

    1. You can do this in RStudio by clicking File -> new Text File

    2. Then File -> Save As

  3. Restart RStudio by pressing 

     in the upper right hand corner of the UI, then "Start New Session"

  4. Check .libPaths() to make sure the correct path is being referenced

Updating your packages

If the system updates R and you find that your packages are no longer importing, please run from RStudio:

 

update.packages(checkBuilt=TRUE, ask=FALSE)

 

Running R scripts outside of RStudio

It is possible to run R scripts that can either be run directly on the command line or scheduled via our SLURM job scheduler. For information on SLURM, please refer this article: How-to: Scheduling via SLURM

You can simply call your R script within a SLURM SBATCH script with

Rscript name_of_script.r

NOTE: If you would like to install packages within your R script, you will need to specify a directory on our cluster in which to store them. This is preferably a lab directory, which has 10TB of storage; installing a package in your home directory runs the risk of having your home directory become full very quickly

A sample install within your R script can look like

install.packages("name_of_pkg", repos="repo_for_pkg", lib="/path/to/pkg/install/dir")

As of 5/9/2025: You will need to specify the node uagc20-01 within your SLURM script using the --nodelist flag. We are in the process of adding R-devel to the other nodes on our cluster

If you would like to use R in this way, please submit a ticket to UAlbany ITS requesting a packet of only brown M&Ms