[R] Writing R Scripts and passing command line arguments

cls59 chuck at sharpsteen.net
Mon Sep 7 20:37:12 CEST 2009



Abhishek Pratap wrote:
> 
> 
> 1. What's the best way to pass command line arguments to R scripts ?
> 
> 

As Gabor mentioned, the commandArgs function and the getopt package provide
some excellent starting points for this.



Abhishek Pratap wrote:
> 
> 
> 2. How to execute R scripts from command line ? When I use R CMD BATCH I
> see 
> no output on the screen 
> 
> 

I believe R CMD BATCH dumps all of it's output to a file ending in .Rout. If
you want more control over input and output to your script then Rscript is
the utility to use.


Abhishek Pratap wrote:
> 
> 
> 3. What does R --slave --vanilla do  ?
> 
> 

If I recall correctly, --vanilla makes it so that R does not waste time
trying to load a previously saved session and also makes it so that R does
not try to save history and environment variables when it exits. Vanilla
also disables the loading of options from profile files such as ~/.Rprofile.

I think --slave makes R shut up about it's self and run more quietly than it
normally does.

Hope that helps!

-Charlie

-----
Charlie Sharpsteen
Undergraduate
Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: http://www.nabble.com/Writing-R-Scripts-and-passing-command-line-arguments-tp25334067p25334648.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list