[R] Use R in a pipeline as a filter
Dirk Eddelbuettel
edd at debian.org
Fri Jun 8 16:40:07 CEST 2007
On 7 June 2007 at 14:27, mw-u2 at gmx.de wrote:
| how can I use R in a pipline like this
|
| $ ./generate-data | R --script-file=Script.R | ./further-analyse-data > result.dat
The 'r' in our 'littler' package can do that. One example we show on the
littler webpage is
$ ls -l /boot | awk '!/^total/ {print $5}' | \
r -e 'fsizes <- as.integer(readLines());
print(summary(fsizes)); stem(fsizes)'
We use R's readLines to read from stdin, and you can of course also have r
'in the middle' if you take care of the output generated -- which our example
doesn't do as it prints straight to screen.
Dirk
--
Hell, there are no rules here - we're trying to accomplish something.
-- Thomas A. Edison
More information about the R-help
mailing list