[R] run R under DOS prompt
yuling5 at yahoo.com
Thu Feb 15 20:20:28 CET 2001
Thanks! This is helpful!
Another question. When I type "Rterm --slave < xxx.R"
under DOS prompt,
the output also shows on the screen. How to write the
output to a .txt file instead
of showing them on the screen?
--- Duncan Murdoch <dmurdoch at pair.com> wrote:
> On Tue, 13 Feb 2001 15:27:22 -0800 (PST), you wrote:
> >I have a xxx.R file. In order to run this file, I
> >to go to R, and type -- source("xxx.R").
> >Two questions:
> >1. How to run file xxx.R under DOS prompt instead
> >entering R environment?
> Rterm --slave <xxx.R
> Look in the R-intro manual for options other than
> --slave that you
> might want to use.
> >2. There are several functions in file xxx.R, how
> >pass the arguments
> >to the function when I try to run this file via
> >source() function (or under DOS mode)?
> You can't, but you can add extra lines to the file
> with calls
> containing the arguments. For example, you might
> myfunc <- function(x)
> in xxx.R. If you want to call myfunc(34), then
> first source the file,
> then execute myfunc(34). If doing it in batch mode,
> copy the file to
> a temp file, add the line "myfunc(34)" to the end,
> and execute the
> temp file.
> Duncan Murdoch
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
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