The amazing Randy Lai recently posted a bug report on the R-devel mailing list. His example pipes text into an R process that executes the script in test.R.

$ echo "abc\nfoo" | R --slave -f test.R

R can run on the command line, read from stdin and write to stdout, which means you can build shell pipelines with R. This can be a nice way to combine several data processing steps in multiple languages.

$ cat data.txt | R –slave -f step1.R from Randy Lai