R shell integration.
Barry Rowlingson
B.Rowlingson@lancaster.ac.uk
Mon, 04 Nov 2002 15:46:27 +0000
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?
Current problems with this are:
* linux will only execute binaries from #! scripts, so a C-code wrapper
is needed
* R can only take commands from standard input, so I cant see how to get
it to read commands _and_ data from standard input. Could a new option
be added to read commands from a file given on the command line?
* nobody has written a 'getopt' function to format the results of the
commandArgs() function :)
- I've already written a (four-line) C wrapper to do the first part,
and it is an interesting feeling to run R with "./runme.R", but the
second problem is slightly trickier.
Is this worth putting any effort into, or did this weekend's fireworks
burn my brain too much?
Barry
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._