I have to develop a web interface allowing the user to enter some inputs that will be passed to an Rscript as parameters and return the result to the user.
I have some questions for someone who have done a similar web interface:
It should be noted that opening a browser from R will do exactly just that; it will not provide a way for R to communicate or control it. Users looking to use R for webscraping should consider using the RSelenium package, as it provides a number of functions to navigate and interact with web pages.
If R is ready to accept commands, the R console shows a > prompt. If it receives a command (by typing, copy-pasting or sent from the script editor using Ctrl + Return ), R will try to execute it, and when ready, show the results and come back with a new > -prompt to wait for new commands.
R is a dialect of the S language. It is a case-sensitive, interpreted language. You can enter commands one at a time at the command prompt (>) or run a set of commands from a source file.
▶ You can run an R file without explicitly opening R.
R has its own web server, so you could do the whole thing within R. Then there's no need to bother with choosing a framework, or getting them to talk to each other and so on - just use an R framework:
http://cran.r-project.org/web/packages/Rook/index.html
If you don't like that for performance or other reasons, pretty much any framework will talk to R one way or another, so use what you are familiar with. I'd use Django and either call R via Rpy2 or run an Rserve process, but if you can program in PHP or Java then use a framework based on those languages. If you can't program in anything but R then either learn Python or use Rook.
Rstudio has a new server called Shiny which uses node.js for the UI:
https://github.com/rstudio/shiny-server
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