R shell integration.

Neil McKay MD mckay@suna.gmr.com
Mon, 4 Nov 2 12:57:10 EST


Barry Rowlinson writes:

> 
> 
> Wouldn't it be nice to be able to do this:
> 
>   ./analyse.R -gamma=2 <data.in >data.out
> 
> where analyse.R looks like this:
> 
> #!/usr/bin/R
> 
> gamma <- getopt("gamma")
> mydata <- scan(...)
> 
> etc?  In other words, be able to write executable R scripts?
> 

I have a patch for R that does exactly this. (Latest version's
for R 1.5.0; haven't upgraded to 1.6 yet.) It turns out that it
only requires a few minor changes to R, plus an additional 100-some
lines of code. It allows me to write things like:

	#!/usr/local/lib/R/bin/R.bin --script

	cat("Hello world!\n")


If anyone's interested in the patches, I'll upgrade them to R 1.6
(which I should do anyway) and give them to you. It would be nice
to have these patches pre-applied to the R sources so I don't have
to maintain them myself. (Hint, hint.)

-- 
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@gmr.com
30500 Mound Road
Warren, Mich. 48090

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._