[R] read input from STDIN

yiping.fan@syngenta.com yiping.fan at syngenta.com
Thu Dec 27 21:35:29 CET 2001

   I have a perl program which produces the input. Instead of print it to a
file then let R read the file,
I want to let R to read the input directly from the perl output, 

I am using  a PERL IPC::open2 module for this, 

local (*Read,*Writer);
$pid = open2(\*Read, \*Writer, "R --no-save --slave< my.R")

#input to R
  print Writer data;
close Writer;

#R output
@result = <Read>;

How can "my.R"  read the stdin and figure out the relationship in the data?
I tried realLines(), does not work.  Thank you very much for your help!!


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list