From mckay@suna.gmr.com  Mon Nov  4 17:57:10 2002
From: mckay@suna.gmr.com (Neil McKay MD)
Date: Mon, 4 Nov 2 12:57:10 EST
Subject: R shell integration.
In-Reply-To: <3DC69653.8020209@lancaster.ac.uk>; from "Barry Rowlingson" at Nov 4, 102 11:37 am
Message-ID: <200211041757.gA4HvAV25802@math.ma.gmr.com>

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


R shell integration.
Neil McKay MD