[R-gui] Small annoyance while interacting with R

James Wettenhall wettenhall at wehi.EDU.AU
Tue Oct 25 16:39:17 CEST 2005

Hi Pablo,

> 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.

Yes, interfacing multiple programming languages can be difficult.  So have
you considered just writing all your code in one language?  Maybe you have
more expertise in Ruby than R, but maybe the time it would take to learn
to write all your code in R would be less than the time it would take to
learn how to interface R with other languages?

Just a thought,

> 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
> _______________________________________________
> R-SIG-GUI mailing list
> R-SIG-GUI at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-gui

More information about the R-SIG-GUI mailing list