[R] Problem Writeing a pipe using R (stdin is consumed)

Huntsinger, Reid reid_huntsinger at merck.com
Fri Feb 21 18:59:02 CET 2003

Perhaps a named pipe (aka fifo) would solve your problem? You could
write to it from an arbitrary process and read from it from
your R program.

Reid Huntsinger

-----Original Message-----
From: Alberto Gobbi [mailto:agobbi at anadyspharma.com]
Sent: Friday, February 21, 2003 11:16 AM
To: r-help at stat.math.ethz.ch
Subject: [R] Problem Writeing a pipe using R (stdin is consumed)

Hi everybody,
I a, trying to use R as a pipe like this:

cat inputData | R --silent RCommandFile >outputData

The RCommandFile would contain something like readLines(stdin()).
I have tryed various things and none did work cleanly.

One possible solution is to use the pipe() function inside R and to pass in
the "cat inputData" however this is not very convenient
since I would like to use variable commands to generate the inputData which
are much more complex than just "cat inputData" they might consist
themselves of multiple pipes.

The problem is that R uses the stdin for itself to read commands and I could
not find any solution.

Thanks a lot,

R-help at stat.math.ethz.ch mailing list


More information about the R-help mailing list