[Rd] Pipe / Fork: Partial Solution / Providing Connections from C?
p.dalgaard at biostat.ku.dk
Fri Feb 11 14:32:20 CET 2005
"Jan T. Kim" <jtk at cmp.uea.ac.uk> 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
> 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
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-devel