Index of /examples/r/examples/misc_args

Icon  Name                    Last modified      Size  Description
[DIR] Parent Directory - [   ] args.R 19-Feb-2014 19:54 530 [   ] r_job 19-Feb-2014 20:05 253 [   ] rscript_job 19-Feb-2014 20:05 43

Passing arguments to R script from a command line

args.R script processes the command line and, if arguments are given, assigns the values to the appropriate variables

Interactive execution:

You can execute the code interactively:
scc1% R -q --slave --vanilla --args 10000 21.7 2.2 < args.R
The first 3 options are optional:
  • -q option runs R in a "quiet" mode - startup message is not printed
  • --slave option make R run as quiet as possible - does not print the R script
  • --vanilla option tells R not to search for user-defined enviroment variables

  • The alternative way to run the code interactively:
    scc1% Rscript args.R 10000 21.7 2.2

    Submit R job:

    This directory contains 2 script files - r_job and rscript_job, which submit the job using R and Rscript commands respectevely and pass arguments to the R script.
    scc1% qsub r_job
    scc1% qsub rscript_job

    Users who are members of any Medical Campus projects must also include their project group name:
    scc1% qsub -P scv r_job
    scc1% qsub -P scv rscript_job

    Contact Information:

    Katia Oleinik: