R: Difference between revisions

24 bytes added ,  4 years ago
Marked this version for translation
(Added installation to local library directory)
(Marked this version for translation)
Line 91: Line 91:
=== install.packages() === <!--T:69-->
=== install.packages() === <!--T:69-->


<!--T:18-->
To install packages from [https://cran.r-project.org/ CRAN], you can use <tt>install.packages</tt> while running an interactive R session on the cluster's login node. Many R packages are developed using the GNU family of compilers so we recommend that you load a <tt>gcc</tt> [[Utiliser des modules/en|module]] before trying to install any R packages. Use the same version of the <tt>gcc</tt> for all packages you install.
To install packages from [https://cran.r-project.org/ CRAN], you can use <tt>install.packages</tt> while running an interactive R session on the cluster's login node. Many R packages are developed using the GNU family of compilers so we recommend that you load a <tt>gcc</tt> [[Utiliser des modules/en|module]] before trying to install any R packages. Use the same version of the <tt>gcc</tt> for all packages you install.
{{Command
{{Command
|module load gcc/7.3.0 r/4.0.2
|module load gcc/7.3.0 r/4.0.2
}}
}}
==== Installing for a specific R version ====
==== Installing for a specific R version ==== <!--T:18-->
For example, to install the <tt>sp</tt> package that provides classes and methods for spatial data, use the following command on a login node:
For example, to install the <tt>sp</tt> package that provides classes and methods for spatial data, use the following command on a login node:


Line 113: Line 112:
Some packages require defining the environment variable <tt>TMPDIR</tt> before installing.
Some packages require defining the environment variable <tt>TMPDIR</tt> before installing.


==== Installing for one or many R versions ====
==== Installing for one or many R versions ==== <!--T:79-->
Specify the local installation directory according to currently R module that is loaded.
Specify the local installation directory according to currently R module that is loaded.
{{Commands
{{Commands
Line 122: Line 121:
{{Command|R -e 'install.packages("sp", repos{{=}}"https://cloud.r-project.org/")'}}
{{Command|R -e 'install.packages("sp", repos{{=}}"https://cloud.r-project.org/")'}}


<!--T:80-->
In your submission script, you then have to load the desired R module and set the local library directory with <tt>export R_LIBS=~/.local/R/$EBVERSIONR/</tt>.
In your submission script, you then have to load the desired R module and set the local library directory with <tt>export R_LIBS=~/.local/R/$EBVERSIONR/</tt>.


cc_staff
284

edits