R CMD BATCH w/o inputs?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

R CMD BATCH w/o inputs?

ivo welch-2
dear R wizards---I must be standing on the line (German
translation---this must be obvious).  This is probably embarrassingly
obvious to anyone, except to me right now.  maybe it is late.

I would like to run my R code in batch, but not see the R compilations
and my R source code---I just want to see the same output that I would
see if I ran source("i.R"), but direct it to a file.  I can of course
direct R output to a file ($ R > myoutput), and then type the source
and exit statements blindly, but there must be a better way---I just
don't know it.

what am I missing?

regards,

/iaw

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R CMD BATCH w/o inputs?

Marc Schwartz (via MN)
On Mon, 2006-03-13 at 20:17 -0500, ivo welch wrote:

> dear R wizards---I must be standing on the line (German
> translation---this must be obvious).  This is probably embarrassingly
> obvious to anyone, except to me right now.  maybe it is late.
>
> I would like to run my R code in batch, but not see the R compilations
> and my R source code---I just want to see the same output that I would
> see if I ran source("i.R"), but direct it to a file.  I can of course
> direct R output to a file ($ R > myoutput), and then type the source
> and exit statements blindly, but there must be a better way---I just
> don't know it.
>
> what am I missing?
>
> regards,
>
> /iaw


Something like this, which is covered in section "B.1 Invoking R from
the command line" in An Introduction to R:

http://cran.r-project.org/doc/manuals/R-intro.html#Invoking-R



# First you have a text file with R commands, say 'add.R',
# which contains:

1 + 2


# You want to have R take its input from the above file
# and output the result to a text file called 'addout.txt'
# Note the options 'vanilla' and 'slave':

R --vanilla --slave < add.R > addout.txt


The contents of 'addout.txt' will be:

[1] 3


Is that what you were looking for?

HTH,

Marc Schwartz

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R CMD BATCH w/o inputs?

ivo welch-2
hi marc:  yes, this is it.  I tried --slave alone, which had not been
enough.  thanks.  regards, /iaw

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html