Running R Jobs
Quickstart: R
Option A - Your Container (recommended)
Build a container with R & packages installed inside. Start by reviewing
the container build instructions for either Apptainer or Docker. Then, when
following the build instructions, use the example recipes for either a
.def
or Dockerfile
, respectively.
- How to build your own container: Apptainer / Docker
- Tips and tricks, container recipes: Example container recipes for R
- Use your container in your HTC jobs: Apptainer / Docker
Option B - Existing Container
Use an existing container with a base installation of R:
- Choose an existing container. See OSG R containers or Rocker R containers.
- Use the container in your HTC jobs: Apptainer / Docker
More information
No CHTC machine has R pre-installed, so you must configure a portable copy of R to work on the HTC system. Using a container as described above is the easiest way to accomplish this.
Executable
When using a container, you can use a .R
script as the submit file executable
, provided that the first line (the “shebang”) in the .R
file is
#!/usr/bin/env Rscript
with the rest of the file containing the commands that you want to run using R.
Alternatively, you can use a bash .sh
script as the submit file executable
, and in that file you can use the Rscript
command:
#!/bin/bash
Rscript my-script.R
In this case, remember to include your .R
file in the transfer_input_files
line of your submit file.