ARCHIVED: Install R packages on the Karst RStudio server

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.
Note:

UITS retired the RStudio web interface on June 30, 2018. UITS recommends accessing RStudio via the menu bar in Research Desktop (RED) Beta. For more about RED Beta, including how to get access, see About Research Desktop (RED) at IU.

At Indiana University, UITS operates a web-accessible instance of RStudio Server on the Karst research computing cluster. Users can install R packages in their Karst home directories.

The following example creates a directory called r-packages and writes a line in the file .Renviron. This file stores the system variable R_LIBS_USER.

system("mkdir ~/r-packages")
setwd("~/r-packages")

fileName <- file(".Renviron")
x="R_LIBS_USER = \"~/r-packages\""
writeLines(x, fileName)
close(fileName)

After creating the .Renviron file, you can install packages from the CRAN repository with the install.packages command:

install.packages("my_r_pkg")

This is document apho in the Knowledge Base.
Last modified on 2023-05-09 14:40:33.