How do I run R (Rscript) from the Command Line?

If you tried to use the Rscript command to run R from the command line, you might have gotten this result:

Command 'Rscript' not found, but can be installed with:

apt install r-base-core
Please ask your administrator.

Rscript itself is a part of the R suite of tools, which can be loaded using the module system.

module load R

This will load the default version of R on the Yens. To see all of the versions you can load, use module avail and pick the specific version you wish to load, e.g.:

 module load R/4.0.0

At this point, Rscript will be available in your path to call R scripts from the command line:

Rscript foo.R