At least in the Unix version of the ``Rscript`` front-end to R (but oddly enough not ``R CMD BATCH``) you could put something like this in test.R:

cat("Save workspace image? [y/n]: ")
answer <- tolower( scan("stdin", "", n=1) )
if (substr(answer, 1, 1) == "y") {
    q("yes")
} else {
    q("no")
}

Which you would use like this:

Rscript test.R

Angel Spassov wrote:
DeaR list,

let us assume we have stored a couple of functions in 'test.R'. Is it
possible to run

R CMD BATCH "test.R"
or
R --file="test.R"

interactively and if yes how?

A better formulated question sounds like this: how can I source "test.R"
interactively OUTSIDE R?

Another clarification try: I want to fix the
"<my-command> in non-interactive use: command-line default will be used"
Warning Message.

The last one can be reproduced if you type for example:
q("ask")
in "test.R".

I hope at least one of the questions above was formulated understandably.

Thx in advance,
AS

        [[alternative HTML version deleted]]


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to