Skip navigation
NASA Logo, National Aeronautics and Space Administration
Currently Being Moderated

How to Install a Package to R on discover

VERSION 1 
Created on: Sep 13, 2018 11:53 AM by Jules Kouatchou - Last Modified:  Sep 13, 2018 12:12 PM by Jules Kouatchou

This document briefly describe how discover users can install a R package in their own space. Assume that you want to install the rbenchmark library.

 

Step 1: Load an R module

Issue the command:

 

     module load other/R-3.4.2

 

Step 2: Launch R

Issue the command:

 

     R

Step 3: Install the package from R

 

> install.packages("rbenchmark", lib="fullPath_of_Directory_where_to_install")
>quit()

 

Step 4: Set the R_LIBS environment variable

 

In Cshell

setenv R_LIBS fullPath_of_Directory_where_to_install

 

In Bash Shell

export R_LIBS=fullPath_of_Directory_where_to_install

 

 

To have access to the package, you will only need to add the line:

 

library(rbenchmark)

 

on top of your R script.


Comments (0)
USAGov logo NASA Logo - nasa.gov