Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

Many R packages have been built for us and are available when we load R with the module system. For example, the module r/4.0.5-py27 makes available about 514 packages, including tidyverse, rstan, etc.

But you are likely to encounter instances where you want packages for yourself, ASAP, and that you don’t have a sense how likely others would be to use them. If so, this guide will give instructions for ways to do this.

Otherwise, for packages that are likely helpful for many users, see these considerations and ask ARCC to install these as part of the R module.

Packages that you want to share with others in your project space

On teton, do the following steps. At the UNIX command prompt, where you will need to substitute your project name for MYPROJECTNAME:

mkdir -p /project/MYPROJECTNAME/share/Rlibs/r4.0/
module load swset/2018.05 gcc/7.3.0 r/4.0.5-py27
R

Then, as below, within R and at its prompt, first prepend the new directory for R packages to the libPaths variable. This directory will be your primary directory and the system-wide, administrator controlled directory will be secondary. Then install a package (here the wesanderson color palette and load the library.

.libPaths("/project/MYPROJECTNAME/share/Rlibs/r4.0/")
install.packages("wesanderson")
library(wesanderson)

In future sessions, you or another member of your research project group will be able to start an R session and simply do the following to use this package (after substituting your project name for MYPROJECTNAME).

.libPaths("/project/MYPROJECTNAME/share/Rlibs/r4.0/")
library(wesanderson)

Packages that only need to be accessible to you

If R packages can reside in your personal workspace (home directory), you can do the following.

Load R.

module load swset/2018.05 gcc/7.3.0 r/4.0.5-py27
R

In R, install the package you want. It will be installed in ~/R/x86_64-pc-linux-gnu-library/4.0 by default.

install.packages("wesanderson")
library(wesanderson)

Problems encountered and solutions offered

  • No labels