Installing R packages locally
Installing R packages locally.
- Create .Revniron in your home directory
- Create directory /vlsci/SG000x/shared/rlibs/ – where x is your group id
- Add the following lines – change repository to one you would like to use
“r <- getOption(“repos”) # hard code the US repo for CRAN
r[“CRAN”] <- “http://cran.us.r-project.org”
options(repos = r)
Note: If you want the r package to be used just by yourself you can create the directory in your home directory. If you want the R package to be used with all in your project you can place the rlibs directory in the project shared directory.
4. Log into helix
5. Stay in the head node and “module load R” or which ever R version you wish to use. Note: if you install using an older version of R if you decide to move to a newer version of R you may not be able to use the packages.
6. Start R
7. Use install.packages to install dependencies.
8. Exit R
9. Install package build using R CMD INSTALL –library=/vlsci/SG000X/shared/Rlib/ <package>.tar.gz
Note: you will need to install the following dependencies first.
It would be nice to install a package locally but download all dependencies from CRAN. The only way I have found that this would work is by setting up a local repository with the required dependencies, otherwise all dependencies will need to be installed manually.