Using R Scripts on Alma - Environments
Creating an environment with your installations will enable you to use R on Alma in a reproducible manner. The environment can be shared with colleagues, help desk, and collaborators to ensure that the same environment is used for the same results. It also means that in the future you can recreate the environment to run the same notebooks.
If you haven't already, follow the setup mamba instructions to get mamba working.
-
First get an interactive session:
-
Follow the steps for creating a new environment in the mamba documentation and activate it. Create a mamba environment, just like with python, though there are a few modules we know we are likely to want with R.
-
Check you have the environment you expect
-
Load CMake You will need to load the CMake module to install some R packages that need to be installed from source.
-
Installing packages It is preferable to use mamba to install R packages like ggplot2 etc. In general, if there is a package that you could install with install(packages), you can install it with mamba install with an "r-" in the front - not always, but it is the best way to try.
-
Packages that do not have an "r-" module Can be loaded in an R script in the usual way, or form the command line like:
-
Export and import the environment
-
Deactivate the environment
-
import the environment