[R] how to pass external parameters to an R script

Ista Zahn istazahn at gmail.com
Tue Feb 23 17:28:56 CET 2010

Hi Maura,

See ?Rscript


On Tue, Feb 23, 2010 at 10:45 AM,  <mauede at alice.it> wrote:
> How, if possible, can I run an R script, from command line, passing external parameters just like
> I can run a C main program passing parameters:
> # Cprog p1 p2 p3
> Cprog can access its arguments (p1,p2,p3) through the built-in structures "argv" and "argc".
> Since R is built on C language I would expect the same feature to be available with R scripts as well ... ?
> Please, notice that I do not mean to open an interactive R session, assign values to p1, p2, p3 and then
> call the R script from the same interactive session. This way I daresay that p1, p2, p3 would be known to
> the R script as global variables.
> Thank you very much.
> Maura
> tutti i telefonini TIM!
>        [[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org 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.

Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology

More information about the R-help mailing list