R can also be run from the command line in Beocat. This can be faster with practice, and is easier to automate.
This requires accessing Beocat via SSH. The Beocat Linux Basics page is a great resource that provides details on how to do this, as well as cheat sheets for navigating and working with files from the command line.
Once you have connected to Beocat, you can start R interactively by entering the following:
module load R
R
To install any desired packages, use:
install.packages("PACKAGENAME")
To run scripts from the command line, you will need to make a bash script that will call R. Here is an example. Save this file as an sbatch file (i.e., submit-R.sbatch).
#!/bin/bash -l
# Allocate the desired amount of memory to the script
#SBATCH --mem-per-cpu=4G
# Now we tell Slurm how long we expect our work to take: 15 minutes (D-HH:MM:SS)
#SBATCH --time=0-00:15:00
# Now lets do some actual work. This starts R and loads the file myscript.R
module purge
module load R
R --no-save -q < myscript.R
To submit this job, use:
sbatch submit-R.sbatch
To monitor the job status, use:
kstat --me
When the job is done, you will find the output in a slurm-#.out file. The # will be the ID number for your job.
For more information on sbatch scripts, check out the AdvancedSlurm page.