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 UNIX cool. However what I can't find is how to specify what function I want to run on 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.
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 underUNIX> >cool. > > > >However what I can't find is how to specify what function I want to runon> >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 > > > >
Greetings All, I just wanted to say, somewhat belatedly, a huge thank you to all those who answered my question. I hope I have got all of you:: Thanks to Ruud, Jonathan, James, Martin, Andrew and Dennis. Basically the solution and noted by these helpful people is to use infile thereby creating an infile with php (using simple file io) calling R from the command line with infile and writing the results to and output file which can then be opened by PHP later. The batch file call would be something like (from Ruud):: path_to_R\bin\Rterm.exe --no-restore --no-save < %1 > %1.out 2>&1 And away I go. Again thank you all :-) Z. ----- Original Message -----> Greetings All, > > Just a quick query about calling R. Looking through the manual you startR> 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 (ratherthan> 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 UNIX > cool. > > However what I can't find is how to specify what function I want to run on > my infile, say calculate standard deviation or means or linear regression > and getting probabilities translations for t-statistics. Have I missedthis> 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 > >