ARCHIVED: Install and load R packages on Big Red II at IU

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

R is a language and environment for statistical computing and graphics. R provides a wide variety of statistical (for example, linear and nonlinear modeling, classical statistical tests, time-series analysis, classification, and clustering) and graphical techniques, and is highly extensible. For more, see the R Project for Statistical Computing home page.

To use R on Big Red II, you first must add it to your user environment; for instructions, see ARCHIVED: Use R on Big Red II at IU.

On this page:

Note:

Big Red II was retired from service on December 15, 2019; for more, see About Big Red II at Indiana University (Retired).


Install R packages

You can install R packages in your Big Red II home directory using either of the following methods. Before you begin, create a subdirectory for your package (for example, ~/r-packages); on the command line, enter:

  mkdir r-packages
  • Installing from a locally stored source file: To use a package source file stored in your Big Red II home directory (for example, ~/my_r_pkg) to install an R package to your R package subdirectory (for example, ~/r-packages), on the command line, enter:
      R CMD INSTALL my_r_pkg -l ~/r-packages
    
  • Installing from the CRAN package repository: To download and install a package (for example, my_r_pkg) from the CRAN package repository and install it in your R package subdirectory (for example, ~/r-packages), launch R, and then, at the R command prompt (>, enter:
      install.packages("my_r_pkg", lib="~/r-packages/")
    

Continue to Load R packages.

Load R packages

In R, to load your newly installed package (for example, ~/r-packages/my_r_pkg), at the R command prompt, enter:

  library("my_r_pkg", lib.loc="~/r-packages/")

For more details, type ?INSTALL in the R console.

Get help

If you have questions about using statistical and mathematical software at Indiana University, contact the UITS Research Applications and Deep Learning team.

This is document bfrs in the Knowledge Base.
Last modified on 2019-12-15 07:03:23.

Contact us

For help or to comment, email the UITS Support Center.