[R] run R under DOS prompt
Yu-Ling Wu
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?
Thanks,
Yu-Ling Wu
--- Duncan Murdoch <dmurdoch at pair.com> wrote:
> On Tue, 13 Feb 2001 15:27:22 -0800 (PST), you wrote:
>
> >Hi,
> >
> >I have a xxx.R file. In order to run this file, I
> have
> >to go to R, and type -- source("xxx.R").
> >
> >Two questions:
> >1. How to run file xxx.R under DOS prompt instead
> of
> >entering R environment?
>
> Try
>
> 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
> to
> >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
> have
>
> myfunc <- function(x)
> {
> print(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
mailing list