Is there anyway to run R scripts through Apache and PHP? I would like to be able to pass variables from PHP to R.
Has anyone done something like this?
Essentially, I would like to know if there is a method for passing variables from PHP to R on an apache server.
Overview. SparkR is an R package that provides a light-weight frontend to use Apache Spark from R. In Spark 3.3. 0, SparkR provides a distributed data frame implementation that supports operations like selection, filtering, aggregation etc.
TVS Apache RR310 is a sports bike available at a starting price of Rs. 2,64,980 in India. It is available in only 1 variant and 3 colours. The TVS Apache RR310 is powered by 312.2cc BS6 engine which develops a power of 33.52 bhp and a torque of 27.3 Nm.
To run Zeppelin with the R Interpreter, the SPARK_HOME environment variable must be set. The best way to do this is by editing conf/zeppelin-env.sh . If it is not set, the R Interpreter will not be able to interface with Spark. You should also copy conf/zeppelin-site.
Sparklyr provides a range of functions that allow you to access the Spark tools for transforming/pre-processing data. SparkR is basically a tool for running R on Spark. In order to use SparkR, we just import it into our environment and run our code.
See the R-FAQ:
Two projects use PHP to provide a web interface to R. R_PHP_Online by Steve Chen (though it is unclear if this project is still active) is somewhat similar to the above Rcgi and Rweb. R-php is actively developed by Alfredo Pontillo and Angelo Mineo and provides both a web interface to R and a set of pre-specified analyses that need no R code input.
and this paper: Using R via PHP for Teaching Purposes: R-php
Personally we used the R CMD BATCH interface to R to achieve this. It's not very elegant, but essentially we have a user pasting data into a form which is passed to PhP which generates a .R file with something
x = c(1,2,3,4); dev.off(); plot(x);
Then we get PhP to do an exec "R CMD BATCH "
In the directory you should then get Rplots.ps file which can be served to the client. Equally you can use the jpeg() function to return a jpeg picture of the graphic which can then be displayed on the web page PhP returns.
Not elegant at all, but it works for us.
Rserve now has support for php you can find more info at: http://code.google.com/p/rserve-php/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With