Control R environment using modules: Difference between revisions

From HPCwiki
Jump to navigation Jump to search
No edit summary
 
(10 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Setting up a semi-public repository ==
<source lang='bash'>
<source lang='bash'>
/cm/shared/apps/WUR/ABGC/R/R_libraries/3.0.2/
mkdir /cm/shared/apps/WUR/ABGC/R/R_libraries/3.0.2
</source>
</source>
Note: need to do this only once per version; make sure that the folder does not already exist.
== Create an R module ==


<source lang='bash'>
<source lang='bash'>
mkdir /cm/shared/apps/WUR/ABGC/modulefiles/R/
mkdir /cm/shared/apps/WUR/ABGC/modulefiles/R/
</source>
</source>
Note: need to do this only once per version; make sure that the folder does not already exist.


<source lang='bash'>
<source lang='bash'>
cp /cm/shared/modulefiles/R/3.0.2 /cm/shared/apps/WUR/ABGC/modulefiles/R/3.0.2_wur
cp /cm/shared/modulefiles/R/3.0.2 /cm/shared/apps/WUR/ABGC/modulefiles/R/3.0.2_wur
</source>
</source>
Note: need to do this only once per version; make sure that the file does not already exist.


<source lang='tcl'>
<source lang='tcl'>
#%Module1.0#######################################################################
#%Module1.0#######################################################################
## R3 modulefile
## R3 modulefile modified for WUR/ABGC use
##
##
proc ModulesHelp { } {
proc ModulesHelp { } {


         puts stderr "\tAdds R v3.0.2 to your environment"
         puts stderr "\tAdds R v3.0.2 to your environment and sets WUR/ABGC libraries"
}
}


module-whatis  "Adds R v3.0.2 to your environment"
module-whatis  "Adds R v3.0.2 to your environment and set WUR/ABGC libraries"


set            r3_root        /cm/shared/apps/R3/
set            r3_root        /cm/shared/apps/R3/
Line 29: Line 36:
prepend-path    LD_LIBRARY_PATH  $r3_root/lib64
prepend-path    LD_LIBRARY_PATH  $r3_root/lib64
prepend-path    R_LIBS_SITE      $r3_wur_root
prepend-path    R_LIBS_SITE      $r3_wur_root
</source>
== Load Module ==
<source lang='bash'>
module avail
</source>
  ----------------------------------- /cm/shared/apps/WUR/ABGC/modulefiles -----------------------------------
  bwa/0.5.9  bwa/0.7.5a  R/3.0.2_wur
<source lang='bash'>
module load R/3.0.2_wur
</source>
</source>
== Install R package and check install path ==
<source lang='rsplus'>
install.packages('car')
</source>
  > installed.packages()
            Package      LibPath                                     
  car        "car"        "/cm/shared/apps/WUR/ABGC/R/R_libraries/3.0.2"
== See also ==
* [[Parallel_R_code_on_SLURM | Running parallel workloads in R on Slurm]]
* [[Domain_specific_software_on_B4Fcluster_installation_by_users | Installing domain specific software: installation by users]]
* [[Setting local variables]]
* [[Installing_R_packages_locally | Installing R packages locally]]
* [[Setting_up_Python_virtualenv | Setting up and using a virtual environment for Python3 ]]
== External links ==

Latest revision as of 10:47, 23 May 2018

Setting up a semi-public repository

mkdir /cm/shared/apps/WUR/ABGC/R/R_libraries/3.0.2

Note: need to do this only once per version; make sure that the folder does not already exist.

Create an R module

mkdir /cm/shared/apps/WUR/ABGC/modulefiles/R/

Note: need to do this only once per version; make sure that the folder does not already exist.

cp /cm/shared/modulefiles/R/3.0.2 /cm/shared/apps/WUR/ABGC/modulefiles/R/3.0.2_wur

Note: need to do this only once per version; make sure that the file does not already exist.

#%Module1.0#######################################################################
## R3 modulefile modified for WUR/ABGC use
##
proc ModulesHelp { } {

        puts stderr "\tAdds R v3.0.2 to your environment and sets WUR/ABGC libraries"
}

module-whatis   "Adds R v3.0.2 to your environment and set WUR/ABGC libraries"

set             r3_root        /cm/shared/apps/R3/
set             r3_wur_root    /cm/shared/apps/WUR/ABGC/R/R_libraries/3.0.2/

prepend-path     PATH             $r3_root/bin
prepend-path     MANPATH          $r3_root/share/man
prepend-path     LD_LIBRARY_PATH  $r3_root/lib64
prepend-path     R_LIBS_SITE      $r3_wur_root

Load Module

module avail
 ----------------------------------- /cm/shared/apps/WUR/ABGC/modulefiles -----------------------------------
 bwa/0.5.9   bwa/0.7.5a  R/3.0.2_wur
module load R/3.0.2_wur

Install R package and check install path

install.packages('car')


 > installed.packages()
            Package      LibPath                                       
 car        "car"        "/cm/shared/apps/WUR/ABGC/R/R_libraries/3.0.2"

See also

External links