Connecting Infrastructure, Connecting Research

R

Description
R logo

R is a language and environment for statistical computing and graphics. R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, ...) and graphical techniques, and is highly extensible. More...

Site Version (Latest: v2.10.0) Notes
ngs.rl.ac.uk v2.6.0 (v2.4.1) includes: Matrix(0.999375-3), lme4(0.99875-9), Rmpi(0.5-5)
ngs.oerc.ox.ac.uk v2.6.2  
gla.scotgrid.ac.uk v2.6.2  
ngs.leeds.ac.uk v2.6.0  
ngs.wmin.ac.uk v2.6.0  
vidar.ngs.manchester.ac.uk v2.6.0  

 

License

R is available as Free Software under the terms of the Free Software Foundation's GNU General Public License in source code form. It does not need any special permissions to run on the NGS.

Users of this application should credit the code authors and the NGS accordingly and where applicable the specific site where the code is installed, when publishing work using NGS resources.

Running R on the NGS

R supports a large variety of add on packages and package versions. If a package is required on an NGS site, users can either install it in their home directories on those sites or upload the libraries with the job, or request the site to install the package in the site library. In most cases users will need to install the package for themselves, or upload the library with the job. In this case users should follow the add on packages part of the R manual and set the R_LIBS_USER environment variable to point to their personal library location, as documented in the Managing Libraries section of the R manual.

There a multiple ways in which jobs can be launched on the NGS however the graphical user interfaces for R are not supported.

The examples below all use the example which can be found at:

gsiftp://ngs.rl.ac.uk:2811/apps/R/examples/test.R
  • Submission Using the UI/WMS

    To submit an R job via the WMS, logon to the UI and create a JDL file as below, replacing your ngs ID on the UI for ngsxxxx, then submit using:

    glite-wms-job-submit -o jobIDs -a R.jdl

    Type = "Job";
    JobType = "normal";
    Executable = "/usr/ngs/R";
    Arguments = "R --save";
    StdInput = "test.R";
    StdOutput = "test.Rout";
    StdError = "std.err";
    Myproxyserver= "myproxy.ngs.ac.uk";
    InputSandbox = {"test.R"};
    InputSandboxBaseURI = "gsiftp://ngsui03.ngs.ac.uk:2811/home/ngsxxxx/R";
    OutputSandbox = {"std.err","test.Rout"};
    OutputSandboxBaseDestURI = "gsiftp://ngsui03.ngs.ac.uk:2811/home/ngsxxxx/R";
    Requirements = (
         member("NGS-UEE-R", other.GlueHostApplicationSoftwareRunTimeEnvironment)
    );
    ShallowRetryCount = -1;
    • This job runs the default version of R at the site submitted to. To run a specific version, use NGS-UEE-R_2_6_0 say in the requirements section to /usr/ngs/R_2_6_0 in the executable section.
    • Change ngsxxxx to your ID on the UI box and the subdirectory (the example uses a subdirectory called 'R') to suit your job.
    • Rmpi jobs are possible but are not supported at all NGS sites having R installed. Please contact the NGS support centre if you need to use Rmpi.
    • If using a user library set the R_LIBS_USER variable by adding
      Environment= {"R_LIBS_USER=$HOME/mylibrary"};

      replacing mylibrary with the path to the user libraries. $HOME is the home directory on the system running the job rather than on the UI ie Not ngsxxxx as in the SandboxURI lines of the JDL. If uploading these libraries to the working directory of the job this may be ./myLibrary for example, which will be the same regardless of which system the job runs on.

  • NGS Web Portal Submission
  • After logging in to the NGS Portal, select the "R" template under the " Data Analysis" category and make the amendments appropriate for your specific job. Read the description page of the template for further details.

  • Submission Using Globus
  • R can be run on the command line using globus, as below.

    • Example run of R on an example on the NGS node (ngs.rl.ac.uk) at RAL:
    • Copy or stage the example file from

      gsiftp://ngs.rl.ac.uk:2811/apps/R/examples/test.R

      into /home/ngsxxx/R.

      Use the following globus command (one line):

      globusrun -b -r ngs.rl.ac.uk/jobmanager-lsf \
      '&(executable=/usr/ngs/R)(jobtype=single) \
      (arguments= R --save) \
      (directory=/home/ngsxxx/R) (stdin=/home/ngsxxx/R/test.R) \
      (stderr=/home/ngsxxx/R/StdErr.txt) \
      (stdout=/home/ngsxxx/R/test.Rout)'

      The output files test.Rout and Rplot.ps can be accessed at

       gsiftp://ngs.rl.ac.uk:2811/apps/R/R-2.4.1/example 

      for comparison.

    • Example Rmpi parallel run on an example on the NGS node ngs.rl.ac.uk
    • Note the Rmpi is not supported at all NGS sites having R installed. The instructions below are specific to the NGS node at RAL (ngs.rl.ac.uk)

      First copy the file

      gsiftp://ngs.rl.ac.uk:2811/apps/R/R-2.6.0/lib64/R/library/Rmpi/Rprofile

      to your run directory (home/ngsxxx/R in the example) as .Rprofile . Then copy or stage the example file from

      gsiftp://ngs.rl.ac.uk:2811/apps/R/examples/RmpiTest.R

      into /home/ngsxxx/R.

      Then submit via the globus command (all one line removing the '\')

      globusrun -b -r ngs.rl.ac.uk/jobmanager-lsf \
      '&(executable=/usr/ngs/R)(jobtype=mpi)(count=16) \
      (arguments= R --save CMD BATCH RmpiTest.R) \
      (directory=/home/ngsxxx/R) \
      (stderr=/home/ngsxxx/R/StdErr.txt) \
      (stdout=/home/ngsxxx/R/StdOut.txt)'

      (count=16) to be replaced by the number of processes you want to use, and ngsxxx replaced by your ngs unix userid.

      Note that you don't need to use
      mpi.spawn.Rslaves()
      as the slaves are spawned by ScaliMPI mpirun command triggered by globusrun for (jobtype=mpi)

Compilation Information for ngs.rl.ac.uk 

If you need information on how this application was compiled please contact the NGS support centre.

Further Information  

 

Applications Support

The NGS cannot offer scientific support for applications. However if you require further information or believe there is something wrong with the installation, please contact the NGS support centre.

Acknowledgements

Please note: When publishing work based on use of the NGS, users should acknowledge both the authors of any programs used (see the individual program web sites, or contact the authors directly) and the NGS directly using the following line:
"The authors would like to acknowledge the use of the UK National Grid Service in carrying out this work"
This line must also accompany any use of the NGS logos.