An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130328/c0eaebbd/attachment.pl>
how to call R in PHP
3 messages · Lauren Zhang, Jeff Newmiller, Gergely Daróczi
While someone around here might know about PHP (I don't h, the fact that you don't know how to call system suggests that you should be asking in a PHP help forum.
Rserve can be used for interactive sessions, but web services usually aren't designed that way, so you probably want to call R with batch arguments the same way you would call it from the command interpreter, but not actually via the command interpreter.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
Lauren Zhang <zxj19880912 at yahoo.cn> wrote:
Hi,
I met tough problems when calling R in PHP. I have tried several ways,
but none of them succeed.??
first of all, I tried Rserve, but I failed to connect to it.
Then, I tried cmd.exe. I get the result when I use"??R CMD BATCH
--vanilla..." in cmd, but I have no idea how to call cmd in php.
I know "system()" is good to call other systems, I triedbut I get no
result in my html page.
if you could provide some suggestion or examples, i would appreciate
your help.
the code in my php is???
$cmd="R CMD BATCH--vanilla --slave delete.r";
$res=system($cmd);
the code in the delete.r file is:
setwd("c://wamp//www//analysis");
x<-4;
y<-3;
z<-x*y;
sink("125.txt");
png(file="125.png");
barplot(z,border="dark blue")
title(main=list("earning of comparison",font=4));
plot(x,z);
dev.off()
[[alternative HTML version deleted]]
------------------------------------------------------------------------
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130328/7332da3a/attachment.pl>