[R-gui] Small annoyance while interacting with R
Philippe Grosjean
phgrosjean at sciviews.org
Mon Oct 24 17:45:08 CEST 2005
Thomas Friedrichsmeier wrote:
> Hi,
>
>
>>I'm trying to write some program in Ruby to interact with the R console but
>>it doesn't work : in short, I can connect R standard input, output and
>>error and retrieve correct calculations for correct inputs, but as soon as
>>R writes something to the standard error, the program exits.
>
>
> this is from memory, and may not be entirely correct, but roughly it's this:
> If R notices it is not connected to a PTY, it goes into scripting/batch mode
> (i.e. interactive () == FALSE). This means, it will exit on any error. As far
> as I recall, this behavior cannot be changed, or at least not easily so.
> A way to work around this is to embed R:
> http://stat.ethz.ch/R-manual/R-devel/doc/manual/R-exts.html#Linking-GUIs-and-other-front_002dends-to-R
> then set R_ConsoleFile = NULL, and override ptr_R_WriteConsole (Linux) or
> Rd->WriteConsole to point to your own function to handle output.
> Several slightly different solutions are possible, but the key is to avoid
> having R go into batch mode.
>
> Regards
> Thomas Friedrichsmeier
Another way, if you want to simply redirect input and output is to run R
in ESS mode (with --ess flag).
Best,
Philippe Grosjean
More information about the R-SIG-GUI
mailing list