Skip to content

Using R interactively

There are three ways to use R interactively on the cluster. You can use the command line version from the command prompt; you can use the RStudio application from Open OnDemand, or from the Open OnDemand Desktop application you can run either R from a terminal or you can RStudio from a terminal.

RStudio application

To run the RStudio application, go to the Open OnDemand web site and choose the RStudio application from the Interactive Apps menu. The form for RStudio contains fields for the necessary job information.

NOTE: We do not recommend that you install R packages from the RStudio application. See our page on Installing R packages.

R from the command line

R modules

We create three sets of modules that will make R available for use. The first provides just a basic installation of R; the second provides R plus the full tidyverse library collection; the third provides a collection of geospatial packages in addition to the tidyverse collection. These are, respectively: R, Rtidyverse, Rgeospatial. You use the module command to make those available for use; that is, one of these commands:

$ module load R
$ module load Rtidyverse
$ module load Rgeospatial

NOTE: There is a separate module, rstudio, that would be needed if you wish to run RStudio in a window from an OnDemand Desktop application. In most cases you will not want that.

Running R from the command line

Once any of those modules is loaded, you can run R interactively on the command line with

$ R
R version 4.4.1 (2024-06-14) -- "Race for Your Life"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu
[ . . . output deleted . . . ]
Type 'q()' to quit R.
>

You can then enter any R commands you wish. When you q(), you will be prompted whether to 'Save workspace image?'. We highly recommend you not do that.