Install and load R packages into server work space

Users of the CISER research servers may not write to the C drive of the servers, therefore you need to direct the installation of R packages onto your own work space. By default R packages you install will be located within Documents -> R -> win-library -> Rversion number

To install and load R packages to your work space, a sample is shown below of installing the SemiPar package for your reference.

First, using Windows Explorer create a sub-directory on your U drive to store your packages say, RPackages. In example below RPackages is inside my Documents folder.

Then in R, type the following commands:

install.packages(“SemiPar”, lib=”U:/Documents/RPackages”)

library(SemiPar, lib=”U:/Documents/RPackages”)

Note that in the install.packages command, SemiPar is enclosed in quotes, but not in the library command.

You may need to tell R where to look for your installed packages. Do this by locating path to R files, copy it and paste it in following command .libPaths("path").
#example: Using path from above example my packages are saved within U:/Documents/RPackages. I will set that as my library path like so.