[R] R as Unix-Filter and Streams for DataMining

John D. Barnett jbarnett at wi.mit.edu
Fri Dec 3 17:02:48 CET 1999

"Christoph M. Friedrich" wrote:

> Hi,
> i want to use R as a filter in a Unix-like way. So i want to start it
> with
> producerTool | R --no-save --no-restore --slave < Rscript |
> anotherConsumerUnixTool
> inside the Script i put the results to stdout, works fine, but how to
> read in
> from stdin? Its obvious that i have to source the Rscript in a different
> way. Any Hints?

Two (klugey) ideas--

- write a script which reads standard input, and reads a file, and outputs
both of them to standard output.  (Maybe there's a command that does this
already; anyone know?)  You could take this one step further and just make
it a wrapper for R, which would execute any files given on the command
line and then read from standard input.

- put your script (or a command to load your script) into .Rprofile, which
R reads and executes initially.

Sorry, I don't know anything about streams.


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