I am having trouble piping stdin to an R script.
Here is my toy script test.R:
test.R
#!/usr/bin/env Rscript while(length(line <- readLines(
This is the easiest I've found (assuming numeric input):
x <- scan(file("stdin")
you can test it with:
$ echo -e "1\n2\n3" | R -s -e 'x <- scan(file("stdin")); summary(x)' Read 3 items Min. 1st Qu. Median Mean 3rd Qu. Max. 1.0 1.5 2.0 2.0 2.5 3.0