Installing R Packages
Users should install R packages for themselves locally. This documentation shows you how to install R packages locally (without root access) on Oscar.
If the package you want to install has operating-system-level dependencies (i.e. the package depends on core libraries), then we can install it as a module.
First load the R version that you want to use the package with:
module load R/3.4.3_mkl
Start an R session
Note some packages will require code to be compiled so it is best to do R packages installs on the login node.
To install the package 'wordcloud':
> install.packages("wordcloud", repos="http://cran.r-project.org")
You will see a warning:
Warning in install.packages("wordcloud", repos = "http://cran.r-project.org") :
'lib = "/gpfs/runtime/opt/R/3.4.2/lib64/R/library"' is not writable
Would you like to use a personal library instead? (y/n)
y. If you have not installed any R packages before you will see the following message:
Would you like to create a personal library
to install packages into? (y/n)
y. The package will then be installed. If the install is successful you will see a message like:
** preparing package for lazy loading
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (wordcloud)
If the installation was not successful you will see a message like:
In install.packages("wordcloud", repos = "http://cran.r-project.org") :
installation of package ‘wordcloud’ had non-zero exit status
There is normally information in the message that gives the reason why the install failed. Look for the word
ERRORin the message.
Possible reasons for an installation failing include:
- Other software is needed to build the R package, e.g. the R package
gdalso you have to do
module load gdal
- A directory needs deleting from a previous failed installation.
Start an R session:
To remove the 'wordcloud' package: