[R-SIG-Mac] Getting arguments from command line to run a R script

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon May 26 13:39:45 CEST 2008


This is not specific to Mac OS X.

See ?commandArgs and the --args argument to R.

Something that is specific to Mac OS X is that the most convenient way to 
do this is to use Rscript, and I understand that is not installed into the 
standard path on the CRAN binary.  It is I think at

/Library/Frameworks/R.framework/Resources/bin/Rscript

See ?Rscript for how to use it.

On Mon, 26 May 2008, Etienne Toffin wrote:

> Hi,
>
> I use a command line C++ program to run stochastic simulations.
>
> With a shell script I run my program several parameter values and use the 
> command
> R CMD BATCH ../PlotDigging.r
> where PlotDigging.r is a R file that plot several graphics from my simulation 
> results and write a .png file.
>
> Right now I just enter parameter values both in my shell script and my R file 
> : that way I can't launch that much values. So I would like to know if 
> there's a way to launch R CMD as I already do and give it the parameter 
> values entered in the shell script…
>
> Hope I'm clear enough to get an answer…
>
> Thanks,
>
> Etienne
>
> -------------------------------------------------------------------
> Etienne Toffin, PhD Student
> Unit of Social Ecology
> Université Libre de Bruxelles, CP 231
> Boulevard du Triomphe
> B-1050 Brussels
> Belgium
>
> Tel: +32(0)2/650.55.30
> Fax: +32(0)/650.59.87
> Skype: etienne_titou
> http://www.ulb.ac.be/sciences/use/toffin.html
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-SIG-Mac mailing list