[R] Run function in BATCH mode?

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Aug 24 13:10:41 CEST 2004

purmann at mi.fu-berlin.de wrote:

> Hi,
> I am working on a shell script where i need to start a R function defined in a
> script. I know how to run the script; with 
> R CMD BATCH script 
> which would be equal to 
> source("script") in R. 
> But how do I run a function(param) of that script in the BATCH mode? 
> Thanks in advance.
> ______________________________________________
> 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

Say you have a function MyFoo defined in foo.R then you create a file 
call.R that sources foo.r (source("foo.R")) and calls your function by, 
e.g., MyFoo(a, b, x).

Then just say "R CMD BATCH call.R" ...

Uwe Ligges

More information about the R-help mailing list