[R-gui] Small annoyance while interacting with R
Pablo Winant
pablo.winant at ens-lyon.org
Tue Oct 25 16:04:15 CEST 2005
Thank you all,
You understand my problem. I'm running a Linux terminal and unfortunately, the
option --ess does not exist on this plateform. (did you so Philippe for Tinn-R
?).
I have not fully understood if it's feasible to make R believe it is in
interactive mode. From the document about R extensions, I believe I could as a
workaround, talk to a C program embedding R. I must admit it is quite a
difficult task for me (I'm an economist) but I will give it a try.
Pablo
PS : my "program" in ruby under Linux was,
require 'open3'
rin,rout,rerr = Open3.popen3('R --vanilla --quiet')
rin.puts("2+4;")
rerr.gets # returns "2+4;\n" "6\n"
Quoting Duncan Murdoch <murdoch at stats.uwo.ca>:
> On 10/24/2005 11:36 AM, 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.
>
> It can be easily changed (at least on some platforms), but the method
> is not obvious. In Windows if Rterm.exe is started with command line
> option --ess it acts pretty much the way Pablo wants. This is
> documented as a Windows-only option; I'm not sure what the method
> would be to achieve the same on other platforms.
>
> Duncan Murdoch
>
More information about the R-SIG-GUI
mailing list