R: Difference between revisions

From Cheaha
Jump to navigation Jump to search
m (added category biostatistics)
Line 16: Line 16:
</pre>
</pre>


The following libraries are available, additional libraries should be installed by the user under ~/R_exlibs
The following libraries are available
 
* /share/apps/R/R-<font color="red">X.X.X</font>/gnu/lib/R/library
* /share/apps/R/R-<font color="red">X.X.X</font>/gnu/lib/R/library
** The default libraries that come with R
** The default libraries that come with R
Line 24: Line 23:
* /share/apps/R/R-<font color="red">X.X.X</font>/gnu/lib/R/bioc
* /share/apps/R/R-<font color="red">X.X.X</font>/gnu/lib/R/bioc
** BioConductor libraries (default package set using getBioC)
** BioConductor libraries (default package set using getBioC)
Additional libraries should be installed by the user under ~/R_exlibs or follow these instructions:
**Make a directory on your home page to install packages/libraries to (DEST_DIR)
**Make a .Rprofile document in your home space (~/) with the following content, i.e. run the following command on your terminal
<pre>
cat > $HOME/.Rprofile <<\EOF
.libPaths(“~/DEST_DIR")
cat(".Rprofile: Setting UK repositoryn")
r = getOption("repos") # hard code the UK repo for CRAN
r["CRAN"] = "http://cran.uk.r-project.org"
options(repos = r)
rm(r)
EOF
NOTE:Change DEST_DIR to the name of the directory you created.
</pre>
**Load R module and open it.
**Run install.packages(“Package_Name”) at the prompt.
**This would install Package_Name to DEST_DIR. To use it just use library(Package_Name)
'''NOTE''': If you install a package with one version of R, it might not be compatible with another version. So it would be advisable to pick one version of R and go with it, so that you don’t have to install multiple versions of the same package.


==SGE Job script ==
==SGE Job script ==

Revision as of 19:03, 5 February 2016

This page is a Generic stub.

You can help by expanding this page..


R is a free software environment for statistical computing and graphics.

SGE module files

The following Modules files should be loaded for this package:

module load R/R-2.7.2

For other versions, simply replace the version number

module load R/R-2.11.1

The following libraries are available

  • /share/apps/R/R-X.X.X/gnu/lib/R/library
    • The default libraries that come with R
    • Rmpi
    • Snow
  • /share/apps/R/R-X.X.X/gnu/lib/R/bioc
    • BioConductor libraries (default package set using getBioC)

Additional libraries should be installed by the user under ~/R_exlibs or follow these instructions:

    • Make a directory on your home page to install packages/libraries to (DEST_DIR)
    • Make a .Rprofile document in your home space (~/) with the following content, i.e. run the following command on your terminal
cat > $HOME/.Rprofile <<\EOF
.libPaths(“~/DEST_DIR")
cat(".Rprofile: Setting UK repositoryn")
r = getOption("repos") # hard code the UK repo for CRAN
r["CRAN"] = "http://cran.uk.r-project.org"
options(repos = r)
rm(r)

EOF

NOTE:Change DEST_DIR to the name of the directory you created.

    • Load R module and open it.
    • Run install.packages(“Package_Name”) at the prompt.
    • This would install Package_Name to DEST_DIR. To use it just use library(Package_Name)

NOTE: If you install a package with one version of R, it might not be compatible with another version. So it would be advisable to pick one version of R and go with it, so that you don’t have to install multiple versions of the same package.

SGE Job script

Sample R Grid Engine Job Script This is an example of a serial (i.e. non parallel) R job that has a 2 hour run time limit requesting 256M of RAM

#!/bin/bash
#$ -S /bin/bash
#$ -cwd
#
#$ -j y
#$ -N rtestjob
# Use '#$ -m n' instead to disable all email for this job
#$ -m eas
#$ -M YOUR_EMAIL_ADDRESS
#$ -l h_rt=2:00:00,s_rt=1:55:00
#$ -l vf=256M
. /etc/profile.d/modules.sh
module load R/R-2.7.2

#$ -v PATH,R_HOME,R_LIBS,LD_LIBRARY_PATH,CWD

R CMD BATCH rscript.R