I think the original poster wanted to read data from stdin, not execute an entire script from stdin; this works on many UNIX-like systems:


d <- read.table("/dev/stdin", header=F);

Otherwise, for code, you can simply pipe (or redirect) to R from the shell:

% R --vanilla --slave < input > outfile

-Aaron

On Jul 9, 2004, at 4:34 PM, Tony Plate wrote:

The easiest way would probably be to do the hack of creating a temporary file to hold stdin, then call R to process that file. That would be easy to do in a shell script.

If this really won't suffice, this older message might lead to something useful:

Rd] R scripting patches for R-1.8.0
Neil McKay mckay at repsac.gmr.com
Thu Oct 16 20:30:20 MEST 2003

Previous message: [Rd] data() misbehaving inside a function
Next message: [Rd] R scripting patches for R-1.8.0
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

---------------------------------------------------------------------- ----------

I've updated my scripting patches to R-1.8.0. These patches
allow you to write shell scripts in R (at least on *nix systems)
by putting

#!/path/to/R.bin --script

on the first line of the script file. If you're interested
in the patches, e-mail me at

        mckay at gmr.com

--
Neil D. McKay, Mail Code 480-106-359 Phone: (586)986-1470 (GM:8-226-1470)
Manufacturing Systems Research Lab FAX: (586)986-0574 (GM:8-226-0574)
GM Research & Development Center Internet e-mail: mckay at gmr.com
30500 Mound Road
Warren, Mich. 48090


At Friday 02:17 PM 7/9/2004, Hayashi Soichi - shayas wrote:
Is there anyway I can write a script which feed input datasource from stdin
and let R process it (maybe frequency report) then output the report to
stdout?




I can't seem to find much info on documentation or FAQ on this topic.



Thanks!

Soichi Hayashi

______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to