[R] Write a script

Jonathan Baron baron at cattell.psych.upenn.edu
Thu Jul 19 18:11:59 CEST 2001

>Dear R users,
>I would like to write a script to launch R commands from a Unix prompt but I
>do not have any idea how to do it. Can someone bring me help please?
>Thanks in advance
>Denis Choquet

I'm sure there are many ways to do this, but one is to write the
script, say myscript.R, just as a list of R commands, and then
write, on the command line:

R --vanilla < myscript.R

See the bottom of http://finzi.psych.upenn.edu/~baron/
for a couple of examples.  The "vanilla" prevents R from reading
various files, which, if they run, will lead it to present
various prompts, etc.  (See R --help for details.)

Jon Baron
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