[R] BATCH processing in R

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Sep 1 21:25:13 CEST 1999


On Wed, 1 Sep 1999, Thomas Lumley wrote:

> On Wed, 1 Sep 1999, Laura Drake wrote:
> 
> > Dear List,
> > 
> > My question is whether it is possible (and if so, how) to enter values
> > into R vectors (R_OUTFILE, and R_INFILE in my example below) from the
> > command line.  In particular, I would like to run R, as a BATCH job,
> > from a shell script, such as the following:
> 
> yes. Use getenv()
> 
> wompom% setenv R_INFILE foobar
> R is a collaborative project with many contributors.
> Type    "?contributors" for a list.
> 
> Type    "demo()" for some demos, "help()" for on-line help, or
>         "help.start()" for a HTML browser interface to help.
> Type    "q()" to quit R.
> 
> > getenv("R_INFILE")
> R_INFILE 
> "foobar" 
> > sink(getenv("R_INFILE"))
> 
> etc at least under Unix (which I presume is where you are if you want to
> use a shell script)

Works under Windows too (although how you set environment variables
depends in the shell in use, as it does under Unix, in fact).


-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list