How does one run an R script forcing the session to be interactive. The docs in ?interative
say that --ess
and --interactive
control this, but I don't see any effect.
Windows:
C:\Program Files\R\R-3.0.1\bin>R -e "interactive()" --ess -s
[1] FALSE
Mac:
$ R -e "interactive()" --interactive -s
[1] FALSE
Any thoughts?
EDIT: I suppose on can hack the base namespace which may work for some things (like install.packages). But this is a poor excuse for a solution...
$ R -e "unlockBinding('interactive',as.environment('package:base'));assign('interactive',function() TRUE,envir=as.environment('package:base'));base::interactive()" --interactive -s
[1] TRUE
You can run R interactively or in batch mode. e.g. type in R from the shell. The window that appears is called the R console. Any command you type into the prompt is interpreted by the R kernel.
Details. An interactive R session is one in which it is assumed that there is a human operator to interact with, so for example R can prompt for corrections to incorrect input or ask what to do next or if it is OK to move to the next plot. GUI consoles will arrange to start R in an interactive session.
That had come up with our beloved littler alternative to Rscript
, and I then added a toggle:
edd@max:~$ r -p -e 'interactive()'
[1] FALSE
edd@max:~$ r -i -p -e 'interactive()'
[1] TRUE
edd@max:~$
It may well be that R
when invoked as you do always sets it to false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With