I'd like to run an interactive binary using system()
within R.
By interactive, suppose I wanted to run the python command-line interpreter from within R (who knows why, but in any case...).
When I run R from the command line (i.e. Rterm), I can start up the python interpreter like so:
> system('python.exe')
Python 2.7.2 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> # I can now type in python commands and basically use the python
# interpreter until I've had enough.
# Now I'll exit the python interpreter:
>>> exit()
> # Presto, I'm back to the R prompt!
The point is, I can interact with the python interpreter from R just as if I'd started the interpreter from the command line in the first place, and I can exit it when I'm done to get back to the R prompt.
Now, let's try the same with the R GUI:
> system('python.exe')
Python 2.7.2 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
> # eh? it exitted?
This just runs python.exe (displaying that welcome message), but then quits straight away - I can't interact with the python interpreter.
My question is -- is there any way (in R GUI, ie the windows one) to run that interpreter and interact with it in the same way that works from any command-line version of R?
(FYI - when I first started learning how to write R packages, my goal as my first ever R package was just to be able to play nethack in R. Worked beautifully (I use linux & hence the command-line R), except when I took it to the windows RGui it would start the process but not be interactive, effectively locking up R until I forcibly ended the NetHack.exe process).