Install R Packages in Your Home Directory
Jump to navigation
Jump to search
If you need to install a new R package that's not present in the system,
Initial Setup
- Load the R environment module:
module load R
- Create the directory in which R packages will be installed
mkdir -p $R_LIBS
- Run R and select
0-Cloud [https]
CRAN mirror.
> getCRANmirrors() Name Country City 1 0-Cloud [https] 0-Cloud 0-Cloud 2 0-Cloud 0-Cloud 0-Cloud 3 Algeria [https] Algeria Algiers 4 Algeria Algeria Algiers 5 Argentina (La Plata) Argentina La Plata 6 Australia (Canberra) [https] Australia Canberra 7 Australia (Canberra) Australia Canberra 8 Australia (Melbourne 1) [https] Australia Melbourne 9 Australia (Melbourne 2) [https] Australia Melbourne 10 Australia (Perth) [https] Australia Perth ... > chooseCRANmirror(ind=1)
Install R Package
- Make sure R environment module is loaded:
module load R; module list R/
- Run R
- Inside R, install packages like this:
install.packages('<package name>')