Re: [Rd] Pipe / Fork: Partial Solution / Providing Connections from C?

From: Peter Dalgaard <>
Date: Sat 12 Feb 2005 - 00:32:20 EST

"Jan T. Kim" <> writes:

> > Well, that is probably reasonably easy, but (not the least due to that
> > fact) I'm still surprised that it has not been done already. I can hardly
> > imagine that I'm the first one to want to use some external utility from
> > an R program in this way.
> >
> > So, what do you R-devel folks do in this case, and what would you
> > recommend?
> I'm still curious about this one. If there really is no way of running
> stuff through external filter processes in R, I'd volunteer to add
> that.
> Best regards & thanks in advance, Jan

If you know how, please do. I have a suspicion it might not be as easy as it sounds because of the producer/consumer aspects. Notice, though, that in most cases you can get by with system() or pipe() and a temporary file for either the input or the output.

I remember speculating about these matters when I was first introduced to pipes in C: They'd show you how to open a pipe for reading and how to do it for writing, but not how to do both with the same process. Took me a while to realize that there is a nontrivial deadlock issue if you try to write to a process that itself is blocked trying to write its output. Now that is of course not to say that it cannot be done with clever multiplexing and buffering techniques -- or multithreading, except that R isn't threaded.

BTW, we met in Heidelberg at the ECMBM ages ago, didn't we?

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (             FAX: (+45) 35327907

______________________________________________ mailing list
Received on Sat Feb 12 00:33:25 2005

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:02:50 EST