[R] Command line R / PHP?

Zitan Broth zitan at mediasculpt.net
Wed Aug 20 18:14:41 CEST 2003

Hi Ruud,

Thanks greatly for your response and apologies for not being clear.

Actually I am reading the offline version of the R manual, packaged with R
as I write this :-)   Right now I am reading about the various methods I can
get get data in and out of R with.  I think the method of R interfacing
directly with a database is elegant in one respect, but for the enterprise
system it is probably safer to go with text files or XML.  Interested to
know what the most efficient method is ... anyway ...

What I am trying to do is use R as part of a web-based system and call R
from PHP.  The common method of interfacing from PHP to many systems is via
the command line (although I could use swig to access R directly but that is
phase 2 ;-) ).  I found in the install notes that I could call
Rterm.exe --no-restore --no-save < infile > outfile (windows, although I
will be rolling out to *nix) however I cannot find a reference of how to
call r-functions from the command line with this -- or perhaps I've missed
the point ?

I did find in the FAQ: 7.22 How can I get command line editing to work?  But
I'm not sure I understand the answer ..

So say as a simple example I want to call sd() (standard deviation) from the
command line what would I type ... or do I need to write some R code and
call this .. ?

I will continue to read .... Z.

----- Original Message -----

> I don't understand your question exactly. Have you looked at
> http://www.r-project.org/ under manuals? Have you looked into Venables and
> Ripley (2002) Modern Applied Statistics 4th Ed., Springer? Ruud
> *********** REPLY SEPARATOR  ***********
> On 8/20/2003 at 5:24  Zitan Broth wrote:
> >Greetings All,
> >
> >Just a quick query about calling R.  Looking through the manual you start
> R
> >with $ R, and then start calling R functions e.g plot whatever.  Sounds
> >pretty funky, and R looks to be *the* open source maths package.  Awesome
> >...  I would like to call R from my favourite glue language PHP (rather
> >than
> >call perl which calls R) if possible.  To call R from the command line is
> >all this would require and this also seems quite possible ::
> >
> >    Batch use: At its simplest, Rterm.exe can be used in a batch mode by
> >commands like
> >        Rterm.exe --no-restore --no-save < infile > outfile
> >
> >And there is more information on this in section B.1 Invoking R under
> >cool.
> >
> >However what I can't find is how to specify what function I want to run
> >my infile, say calculate standard deviation or means or linear regression
> >and getting probabilities translations for t-statistics.  Have I missed
> >this
> >in the docs?
> >
> >Any suggestions are greatly appreciated.   Awesome and a big thanks.
> >
> >Z.
> >
> >______________________________________________
> >R-help at stat.math.ethz.ch mailing list
> >https://www.stat.math.ethz.ch/mailman/listinfo/r-help

More information about the R-help mailing list