If you're intending to run some code that may require user input, then I
share your need. I started two threads on this some time ago [1,2], but as
far as I know it still isn't possible. My workaround is to use "expect", or
to create a temporary .Rprofile if that is not available, from within a
shell script wrapper (see [3], lines 197-221). It isn't pretty, and I'd
love to see support for this kind of use case in R proper (happy to
contribute my time to help if someone with better knowledge of the R source
could guide me), but it's the best solution I've found.

All the best,
Jon

--
[1] https://stat.ethz.ch/pipermail/r-help/2008-January/150786.html
[2] https://stat.ethz.ch/pipermail/r-devel/2008-September/050803.html
[3] https://github.com/jonclayden/tractor/blob/master/bin/tractor#L197



On 26 February 2013 10:07, Marc Aurel Kiefer <marcaurelkiefer@gmx.de> wrote:

> Hi,
>
> when running a R-script like this:
>
> enable_magic()
> compute_stuff()
> disable_magic()
>
> the whole script is parsed into a single expression and then evaluated,
> whereas when using the interactive shell after each line entered, a REPL
> loop happens.
>
> Is there a way to make a script evaluation behave like this, because I
> need a single REPL iteration for every expression in the script.
>
> It doesn't matter if it's a source()-like way or "R CMD BATCH" or even
> feeding stdin to R or whatever...
>
> Regards,
>
> Marc
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

	[[alternative HTML version deleted]]

