[R] Passing command line parameters to a script

Oleg Sklyar osklyar at ebi.ac.uk
Thu Mar 8 03:03:53 CET 2007


#!/bin/sh
echo 'a="${1}"; b="${2}"; source("myRcodeUsing_a_and_b.R"); ' | R 
--vanilla --quiet

and you can run this from shell like:

./callR valueOfa valueOfb

Best, Oleg

akintayo holder wrote:
> Hi,
>  Does any one know if it is possible to create an R script that can use
> command line parameters. I can execute an R script from the command line,
> but I  cannot figure out how to pass parameters to the script. The only
> resources I have found seem somewhat involved or incomplete.
> 
> Any help is appreciated.
> Akintayo
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Dr Oleg Sklyar | EBI-EMBL, Cambridge CB10 1SD, UK | +44-1223-494466



More information about the R-help mailing list