Difference between revisions of "R/Extension"
|Line 10:||Line 10:|
Packages can be installed by the '''packages
Packages can be installed by the '''packages()''' command (we use here the package "actuar" as an example)
Latest revision as of 12:25, 18 November 2020
Since R is highly extensible, users can work with several additional packages supplemented by R developers. You can display the list of already installed packages with the following R command in an interactive session:
This should give you an overview on a common set of R packages. If you require an R package, which is not yet installed, you can either install it locally in your home directory, or you can contact us, such that we can install the package centrally if it is used by many cluster users.
For installing an R package locally, you first have to load the R module corresponding to the version for which it should be installed. After this you can launch R.
module load new gcc/4.8.2 r/3.3.0 R
Packages can be installed by the install.packages() command (we use here the package "actuar" as an example)
This command will cause a warning, since users do not have write access to the library directory of the corresponding R installation:
Warning in install.packages("actuar") : 'lib = "/cluster/apps/r/3.3.0_openblas/lib64/R/library"' is not writable Would you like to use a personal library instead? (y/n)
When asked if you would like to use a personal library, confirm this by typing y. This will create a local library directory $HOME/R/x86_64-unknown-linux-gnu-library/3.3 where the package will be installed at a later stage. Next you will be asked if you like to install the package in your local library directory
Would you like to create a personal library ~/R/x86_64-unknown-linux-gnu-library/3.3 to install packages into? (y/n)
Afterwards the package will be downloaded and installed. The locally installed R package is now ready to be used.