From B.Rowlingson@lancaster.ac.uk  Mon Nov  4 15:46:27 2002
From: B.Rowlingson@lancaster.ac.uk (Barry Rowlingson)
Date: Mon, 04 Nov 2002 15:46:27 +0000
Subject: R shell integration.
References: <D7A3CFD7825BD6119B880002A58F06C20149D189@groexmb02.pfizer.com> <3DC67A8E.5080700@lancaster.ac.uk>
Message-ID: <3DC69653.8020209@lancaster.ac.uk>


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


R shell integration.
Barry Rowlingson