Skip to content
Prev 45204 / 63424 Next

Running R scripts with interactive-style evaluation

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