Skip to content

R, RStudio and r-bioconductor on RCAC clusters

This tutorial shows you how to use R and Bioconductor on RCAC clusters with the r-bioconductor module: how to load it, where your packages are stored, how to open RStudio in your browser, how to install extra packages, and how to run R scripts as batch jobs. It accompanies Genomics Exchange Fall 2026, Session 7.

The steps apply to Gautschi, Negishi, Scholar and Gilbreth, using the module r-bioconductor/3.23-r-4.6.1 (R 4.6.1 with Bioconductor 3.23). The RStudio (bioconductor) app is available on Negishi, Gautschi and Scholar. Gilbreth has no RStudio (bioconductor) app; on Gilbreth, use the module from a terminal (step 2). Anvil and Rossmann are not covered by this tutorial.

  • Prerequisites


    • An RCAC account on Gautschi, Negishi, Scholar or Gilbreth, and a Slurm account (<account-name>). On Gautschi, run slist to list yours.
    • A terminal session on a login node, or a web browser for Open OnDemand.
    • Helpful: basic cluster use (HPC Orientation for Biologists).
  • Objectives


    • Load the r-bioconductor module and check which R and Bioconductor versions you have.
    • Find where R looks for packages and where your own packages go.
    • Start RStudio in your browser through Open OnDemand.
    • Install extra CRAN and Bioconductor packages into your personal library.
    • Run an R script as a batch job and as a job array.

1. Why R on a cluster is a container problem

Many R packages are not pure R. They compile code when you install them and link against system libraries, so an install that works on your laptop can fail on a cluster whose operating system, compilers or libraries are a different version. Different clusters also run different host operating systems.

The r-bioconductor module avoids this by running R inside an apptainer container image. The image is built on Ubuntu 24.04 and includes:

  • R 4.6.1 and Bioconductor 3.23
  • about 400 CRAN and Bioconductor packages
  • its own compilers, so packages that build from source compile inside the container

Because the image is the same everywhere, R behaves the same on every cluster that has the module, whatever the host operating system. The RStudio (bioconductor) app in Open OnDemand runs the same image when you choose R 4.6.1, so code and packages behave the same in RStudio and in batch jobs.

Tip

You do not need to load a compiler module for R packages. The container brings its own.

2. Find and load the module

Log in to a cluster and run:

1
2
3
module --force purge
module load biocontainers
module spider r-bioconductor

module load biocontainers makes the module available; you always load it first. module spider lists the installed versions. You can also run module avail r-bioconductor to see which one is the default, marked (D).

Load the current version and check it:

module load r-bioconductor/3.23-r-4.6.1
R --version

The first line of the output starts with R version 4.6.1 (2026-06-24).

  • 3.23-r-4.6.1 is the default on Gautschi, Negishi and Scholar, and the only version on Gilbreth.
  • Older versions remain for existing projects. Version names mix upper and lower case (for example 3.20-R-4.4.3 and 3.20-r-4.4.3), so copy the exact name from module avail.
  • To confirm the Bioconductor version, start R and run BiocManager::version(). It returns '3.23'.

Why module --force purge

A plain module purge leaves sticky modules loaded. On some clusters the sticky xalt module sets LD_PRELOAD, which breaks programs inside containers. module --force purge removes it. See Running Bioinformatics on RCAC for details.

GPU message on Scholar and Gilbreth

On a login node that has a GPU, such as on Scholar and Gilbreth, loading the module prints BIOC: Enabling Nvidia GPU support in the container. This is information, not an error.

R and Rscript come from the module

After module load, R and Rscript are shell functions that start R inside the container. They work at your prompt and in a batch script after module load. They are not programs on disk, which matters when another tool tries to start them (see the batch job section and the FAQs).

3. Where your packages live

R looks for packages in several libraries. Run .libPaths() in R, or Rscript -e '.libPaths()' at the prompt, to see them:

[1] "/home/<username>/R/rcac-noble/3.23-4.6" "/opt/R/host-site-library"
[3] "/usr/local/lib/R/site-library"            "/usr/local/lib/R/library"
Order Location (.libPaths()) What it holds Can you install here?
1 ~/R/rcac-noble/3.23-4.6 Your personal library for R 4.6.1 Yes, this is the default
2 /opt/R/host-site-library RCAC extras library, maintained by RCAC staff No
3 /usr/local/lib/R/site-library Packages built into the image (about 400) No
4 /usr/local/lib/R/library Base R No

R searches these in order and uses the first copy of a package it finds.

Two things to keep in mind:

  • Your personal library is per cluster. The path ~/R/rcac-noble/3.23-4.6 is the same on every cluster, but each cluster has its own home directory. A package you install on Gautschi is not visible on Negishi; install it on each cluster you use.
  • Your personal library is per R version. R 4.6.1 uses ~/R/rcac-noble/3.23-4.6. Older R versions use other folders; for example, the legacy R 4.6.0 option in the RStudio app uses ~/R/x86_64-pc-linux-gnu-library/4.6, because packages built for one do not work in the other. When you change R version, reinstall the packages you need.

4. RStudio in your browser (Open OnDemand)

Open OnDemand (OOD) is a web portal to the cluster. The RStudio (bioconductor) app starts RStudio on a compute node and runs it in your browser. With R 4.6.1 selected, it uses the same container image and the same personal library as the module, so packages you install in RStudio are available in batch jobs, and the other way round.

Where the app is available

The RStudio (bioconductor) app is available on Negishi, Gautschi and Scholar. Gilbreth has no RStudio (bioconductor) app; on Gilbreth, use the module from a terminal (step 2). Anvil and Rossmann are not covered by this tutorial.

The steps below use Gautschi. The form on Negishi and Scholar has the same R version field. Negishi offers other partitions, and Scholar offers other partitions and QoS options.

Launch a session

  1. Open your cluster's gateway in a browser and sign in with your Purdue Career Account and BoilerKey (Duo):

    Cluster Gateway
    Gautschi https://gateway.gautschi.rcac.purdue.edu/
    Negishi https://gateway.negishi.rcac.purdue.edu/
    Scholar https://gateway.scholar.rcac.purdue.edu/
  2. Select Interactive Apps, then RStudio (bioconductor) under Bioinformatics Apps.

    Pick the right RStudio

    Gautschi also lists a separate app called RStudio under Servers. Use RStudio (bioconductor), which runs the current R and Bioconductor image.

  3. Fill in the form:

    Field What to enter
    Partition cpu for most work.
    Account Your Slurm account (<account-name>).
    QoS normal. standby uses idle capacity, is limited to 4 hours, and can wait longer to start.
    Wall Time in Hours How long you need RStudio, for example 2. The session ends when this runs out.
    Cores The number of cores. There is no memory field: you get about 2 GB of memory per core, so request more cores if you need more memory.
    R version R 4.6.1 / Bioconductor 3.23 (recommended).
    Load extra RCAC site library (advanced) Leave it checked unless you are debugging a package conflict.

    Check the R version every time

    The form remembers your last choice. If you once picked a legacy version, it is preselected the next time. Make sure the R version field shows R 4.6.1 / Bioconductor 3.23 (recommended) before you launch.

    Open OnDemand launch form for RStudio (bioconductor) on Gautschi. A notice at the top says R 4.6.1 is the recommended version, R 4.6.0 retires on 2027-01-15, and R 4.6.1 keeps your packages in ~/R/rcac-noble/3.23-4.6. The form is filled in with partition cpu, the account field left blank, QoS normal, a wall time of 2 hours, 4 cores, R version R 4.6.1 / Bioconductor 3.23 (recommended), and Load extra RCAC site library checked, above the Launch button.

  4. Select Launch.

Connect to RStudio

OOD submits a Slurm job for you and shows a session card. The card says Queued until the job starts, then Running. Start-up is usually under 5 minutes; the standby QoS can wait longer.

The running card shows the compute node, the time remaining, and an R packages and versions button that summarizes where packages come from. Select Connect to RStudio Server to open RStudio.

A running RStudio (bioconductor) session card on Gautschi showing 1 node and 4 cores, the compute node name, the creation time and the time remaining. The R packages and versions panel is open, explaining that each R version runs in a container and that the newest versions use the same image as the module, that R searches your personal library first, then the RCAC extras library if its checkbox is on, then the image, and that BiocManager::install("DESeq2") installs into your personal library. The Connect to RStudio Server button is at the bottom.

Check your libraries in RStudio

In the RStudio console, run:

.libPaths()
BiocManager::version()

The libraries are the same four as in step 3, with your personal library ~/R/rcac-noble/3.23-4.6 first, and Bioconductor is 3.23. If the first library is a different folder, check the R version you launched with (a legacy version uses a different library) and any library settings in your ~/.Renviron (step 5).

RStudio console on Gautschi. .libPaths() lists /home/<username>/R/rcac-noble/3.23-4.6 first, followed by /opt/R/host-site-library, /usr/local/lib/R/site-library and /usr/local/lib/R/library. BiocManager::version() returns 3.23. install.packages("praise") reports Installing package into the personal library, downloads a binary package and finishes with DONE (praise).

RStudio's Terminal tab runs inside the container

The Terminal tab in RStudio runs inside the container, not on the host, so module commands are not found there. Open a terminal on the cluster for module commands and job submission. Loading cluster modules from inside R is not supported in this app.

Legacy R versions in the app

The R version field also offers R 4.4.0 / Bioconductor 3.19 (legacy) and R 4.6.0 / Bioconductor 3.23 (legacy, retires 2027-01-15). These run an older image and use a different personal library, so packages installed under R 4.6.1 are not visible there. Use them only to finish existing projects.

When you are done, save your work and select Delete on the session card to end the job and free the cores.

5. Install extra packages

Install extra packages yourself first. In R (at the prompt after module load, or in RStudio):

install.packages("praise")         # a CRAN package
BiocManager::install("Biobase")    # a Bioconductor package

You do not need a lib= argument. R installs into your personal library and tells you so:

Installing package into '/home/<username>/R/rcac-noble/3.23-4.6'
(as 'lib' is unspecified)

Most packages install as prebuilt Linux binaries, so they usually take a few seconds. R tries the Bioconductor container binaries first, then the Bioconductor repositories, then CRAN through a dated Posit Package Manager snapshot. If no binary exists, R builds the package from source with the compilers in the container.

Before installing, check whether a package is already there: library(<package>) loads it if it is in the image or the RCAC extras library. Contact RCAC only if an install fails (see the FAQs).

Keep libraries separate by R version

Do not point R 4.6.1 at a library from an older R version, and do not use lib= to share one folder across versions. Packages built for one R version can fail to load in another.

Old ~/.Renviron settings follow you

R reads your ~/.Renviron inside the container. In testing on Negishi with r-bioconductor/3.23-r-4.6.1, an R_LIBS_USER line left over from an older setup was read, but the folder it added did not appear in .libPaths(). If you have such lines from an older guide, run .libPaths() to see what R actually uses, and comment the lines out if they cause problems.

To record the exact R, Bioconductor and package versions behind a result, save the output of sessionInfo() with your results. For more on reproducible analyses, see Reproducible Genomics.

6. Run R in a batch job

For anything longer than a quick test, run your R script as a batch job instead of on a login node or in RStudio.

A single job

First, make a working folder in scratch, copy your R script and its input file into it, and change to it:

1
2
3
mkdir -p "$RCAC_SCRATCH/r-analysis"
cp analysis.R sample1.txt "$RCAC_SCRATCH/r-analysis/"
cd "$RCAC_SCRATCH/r-analysis"

Save this job script in that folder as r-analysis.sh, replacing analysis.R and sample1.txt with your own script and input file:

#!/bin/bash
#SBATCH --job-name=r-analysis
#SBATCH --account=<account-name>
#SBATCH --partition=<partition-name>
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --time=01:00:00
#SBATCH --output=%x_%j.out

module --force purge
module load biocontainers
module load r-bioconductor/3.23-r-4.6.1

cd "$RCAC_SCRATCH/r-analysis"
Rscript analysis.R sample1.txt

Match --cpus-per-task to the number of cores your script uses.

Submit it from the same folder:

sbatch r-analysis.sh

Slurm writes the .out log to the folder you submit from, here $RCAC_SCRATCH/r-analysis.

  • Call Rscript directly. Do not write srun Rscript. Rscript is a shell function from the module, not a program on disk, so srun cannot find it and the job fails with execve(): Rscript: No such file or directory. For the same reason, tools that start Rscript as a program (such as timeout, xargs, GNU parallel, or a #!/usr/bin/env Rscript line) will not find it.
  • Size jobs by cores. Set --cpus-per-task and leave out --mem. On the Gautschi and Negishi cpu partitions, memory is allocated in proportion to cores, about 2 GB per core.
  • Write output to scratch. $RCAC_SCRATCH is your scratch directory. Scratch is fast but not backed up, and files not accessed or modified in 60 days are purged, so copy final results to Depot or your home directory.

Use these values for <partition-name> and <account-name>:

Cluster Partition Account Notes
Gautschi cpu Your account (slist lists yours)
Negishi cpu Your account
Scholar cpu scholar Jobs on the default QoS can run for up to 4 hours.
Gilbreth GPU partitions only Your account Gilbreth jobs must request a GPU. Run CPU-only R work on another cluster; see Running Jobs on Gilbreth.

A job array

To run the same script on several inputs, use a job array. List one input per line in inputs.txt and copy it into the working folder:

cp inputs.txt "$RCAC_SCRATCH/r-analysis/"
cd "$RCAC_SCRATCH/r-analysis"

Save this job script in that folder as r-array.sh:

#!/bin/bash
#SBATCH --job-name=r-array
#SBATCH --account=<account-name>
#SBATCH --partition=<partition-name>
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --time=01:00:00
#SBATCH --array=1-4
#SBATCH --output=%x_%A_%a.out

module --force purge
module load biocontainers
module load r-bioconductor/3.23-r-4.6.1

cd "$RCAC_SCRATCH/r-analysis"
INPUT=$(sed -n "${SLURM_ARRAY_TASK_ID}p" inputs.txt)
Rscript analysis.R "$INPUT"

Submit it from the same folder:

sbatch r-array.sh

--array=1-4 runs four tasks; each task reads line 1, 2, 3 or 4 of inputs.txt. The upper number in --array must equal the number of lines in inputs.txt. In analysis.R, read the input name from the command line:

1
2
3
args <- commandArgs(trailingOnly = TRUE)
input <- args[1]
message("Processing ", input)

Each task writes its own log, named r-array_<jobid>_<taskid>.out.

7. Conclusion

You can now:

  • load r-bioconductor/3.23-r-4.6.1 with module --force purge and module load biocontainers first
  • find your packages with .libPaths() and know that your personal library is per cluster and per R version
  • start RStudio (bioconductor) and check the R version before you launch
  • install CRAN and Bioconductor packages yourself, usually as fast binaries
  • run R scripts as batch jobs and job arrays with Rscript called directly

The RStudio (bioconductor) app is available on Negishi, Gautschi and Scholar. Gilbreth has no RStudio (bioconductor) app; on Gilbreth, use the module from a terminal (step 2). Anvil and Rossmann are not covered by this tutorial.

Next steps

FAQs [click to expand]

1. Why do I get Rscript: command not found or No such file or directory?

R and Rscript are shell functions that the module defines when you load it; they are not programs on disk. They work at your prompt and in a batch script after module load biocontainers and module load r-bioconductor/3.23-r-4.6.1. They do not work when another program starts them, such as srun Rscript, timeout, xargs, GNU parallel, or a script that begins with #!/usr/bin/env Rscript. Load the module in the same script and call Rscript directly.

2. My packages disappeared. Where did they go?

Usually one of these:

  • Different cluster. Each cluster has its own home directory, so packages installed on one cluster are not on another. Install them on each cluster you use.
  • Different R version. Each R version has its own personal library. R 4.6.1 uses ~/R/rcac-noble/3.23-4.6; packages you installed under another version are still in that version's folder but are not visible to R 4.6.1.
  • Library moved on Negishi. On Negishi, R 4.6.1 moved its personal library to ~/R/rcac-noble/3.23-4.6 in October 2026. Packages installed for R 4.6.1 before that change are not visible; reinstall them in an R 4.6.1 session.

Try library(<package>) first: many common packages are already in the image or the RCAC extras library.

3. RStudio will not start, or the session ends right away. What should I check?

First check that your home directory is not full: run myquota on a login node. RStudio keeps its session state in ~/.local/share/rstudio, which can grow to gigabytes. Then check the R version and Account fields in the form, and launch again. If it still fails, email rcac-help@purdue.edu with the cluster name and the session ID from the session card.

4. Why is module not found in the RStudio Terminal?

RStudio's Terminal tab runs inside the container, where the cluster's module command does not exist. Run module commands in a login-node terminal instead. Rscript does work in the RStudio Terminal, and it uses the same libraries as the RStudio console.

5. Which R and Bioconductor versions am I using?

At the prompt, run R --version after loading the module. In R or RStudio, run R.version.string and BiocManager::version(). In Open OnDemand, the R version field on the form shows what the session will start. The current version is R 4.6.1 with Bioconductor 3.23.

6. How do I move from an older R module or the old RStudio app?

Load r-bioconductor/3.23-r-4.6.1 (or choose R 4.6.1 / Bioconductor 3.23 (recommended) in the RStudio (bioconductor) app) and reinstall the packages you need. They go into your new personal library, ~/R/rcac-noble/3.23-4.6. Your old libraries are left where they were, so older projects still work with the older version. If you followed an older guide that set R_LIBS_USER in ~/.Renviron, check .libPaths() and comment those lines out if they cause problems.

7. A package fails to install. What now?

If an install stops with a compile error that mentions a missing header file or library, the package needs a system library that is not in the container image. You cannot add system libraries yourself. Try these in order:

  1. Check whether the package is already available: run library(<package>).
  2. Email rcac-help@purdue.edu with the package name, the cluster, the module version, and the full error message. RCAC can help, for example by adding the package to the RCAC extras library.
8. Why did my RStudio session start with an old R version?

The form remembers your last choice. If you once launched a legacy version, it is preselected the next time. Check the R version field every time you launch, and select R 4.6.1 / Bioconductor 3.23 (recommended).

Back to Life Sciences