Daniel Sachse
2010-Jul-14 08:37 UTC
[R] force or "assert interactive use" with the --ess parameter in Windows
Dear R community, I have been perusing your mailing list (via Nabble) but have not been able to find a suitable solution yet. First of all, my aim would be to run R (or Rterm or Rscript) interactively, while still being able to start the session with an R-script and command line parameters. Kind of what "octave --persist" does, if there are Octave folks among you. I have found out about R CMD BATCH ... where I can run scripts with arguments, but not in interactive mode, and have read about using environment variables like R_PROFILE_USER which would allow me to run a script at the beginning of an interactive session, but not to pass command line arguments. Finally, I believe that the --ess option of R (the Windows equivalent of --interactive) might be what I am looking for, but it seems to have no effect at all: C:\Program Files\R\R-2.11.1\bin>R.exe --slave -e "print(interactive());" [1] FALSE C:\Program Files\R\R-2.11.1\bin>R.exe --slave --ess -e "print(interactive());" [1] FALSE I am seriously confused. Is there no such thing as "R --persist MyScript.R myarg1 myarg2" that would run MyScript interactively? Thanks for your time, Daniel
Daniel Sachse
2010-Jul-15 08:33 UTC
[R] force or "assert interactive use" with the --ess parameter in Windows
That is quite sad. On 15.07.2010 10:12, Allan Engelhardt wrote:> On 14/07/10 09:37, Daniel Sachse wrote: >> [...] >> >> I am seriously confused. Is there no such thing as >> >> "R --persist MyScript.R myarg1 myarg2" >> >> that would run MyScript interactively? > > In a word: no. > > Depending on what you are really trying to do, you may find source() > useful from within a R session. > > AllanI even got far enough as to get R to execute a command and stay interactive with C:\...\bin>echo print(interactive()) | R --ess --slave [1] TRUE So, in the same way I could also start sourcing an arbitrary .R-file right from the command line. However, R still terminates the session after running the command piped to it. Do I really have to launch R and then manually type s-o-u-r-c-e- etc. in order to start my programs? Regards, Daniel