[mdlug] simple stats from piping numbers into R?
Jonathan Billings
billings at negate.org
Tue Apr 20 08:39:22 EDT 2010
On Thu, Apr 15, 2010 at 05:33:35PM -0400, Robert Citek wrote:
> That works, but I'd prefer to pipe the data in rather than go through
> the intermediary of a file or a named pipe.
I believe you can refer to "stdin" (I've also seen /dev/stdin) as the
file in scan:
% cat test.r
#!/usr/bin/Rscript
num <- scan("stdin",quiet=TRUE)
summary(num)
% seq 1 100 | ./test.r
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.00 25.75 50.50 50.50 75.25 100.00
--
Jonathan Billings <billings at negate.org>
More information about the mdlug
mailing list