Re: [Rd] two-way communication using Unix pipes

From: Barry Rowlingson <>
Date: Wed 16 Nov 2005 - 15:58:26 GMT

Jonathan Callahan wrote:

> Can someone please explain to me exactly what R is doing with the the
> standard IO handles and whether or not there is any simple way to convince
> it to behave as if it were talking to a user at the other end of a keyboard
> and terminal? I've already tried '--no-readline' but that doesn't solve my
> problem.

This little noddy example works for me:


use FileHandle;
use IPC::Open2;

$pid=open2(*Reader, *Writer, "R --no-save"); print Writer "x=runif(10);print(mean(x))\n"; while($got=<Reader>){

     print "Got ".$got;

Of course, without the \n in the command string it doesnt work at all, but I dont see any problems with R reading from stdin and writing to stdout....

This is on a Linux box, I dont think you mentioned an OS or platform...

Baz mailing list Received on Thu Nov 17 03:14:06 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:33 GMT