4

I developed an R application and I want to deploy it.

Currently the application consists of a set of functions to be run from the command line, like an R package. In order to deploy it, I am thinking of repackaging R Portable adding the necessary libraries and my code to it. My main problem is choosing a proper GUI toolkit.

Production Environment

My app is a single-user one (i.e. a Desktop application) and the target platform is Windows. It could bootstrap in R and then call the toolkit, or bootstrap, say, in Java and then call the R engine. The GUI should first and foremost feed the app functions. It should also grab the function graphical output.

Possible Alternatives

Here is a potential list of alternatives. I’d like to know if they meet/fit the requisite environement described.

Java JRI is now released only as a part of rJava, but while the latter is clearly documented, I am unable to find docs and tutorials for the former. As for Deducer, it is presented as a GUI front-end, but I found out that it is also a GUI toolkit

TCL/Tk bindings seem a natural choice for R and are well documented, but someone complains about limitations of this toolkit. RGtk2 seems interesting and there are also some tutorials around. gWidgets is one of the rare toolkits to sport a package vignette!

Despite I don’t need a real web application, an interesting option would be interfacing R with JavaScript/HTML. As most of us, I am familiar with this environment and the app could benefit of the many JS libraries. The problem is that the beautiful Shiny server and rApache are for Linux only and this is probably true probably Concerto too. Instead Rserve runs on Windows and, while there is no official JS client, I found the third party rserve-js and also a node.js client. Rook, by the same author of rApache, should be platform agnostic (isn't it?). R Server Pages could work, but I didn't find examples on the functions HttpDaemon and HttpRequest in the vignette or reference manual. I run some simple examples with gWidgetsWWW. It works, but it seems to produce canned web pages, without the possibility of modifying the HTML code.

EDIT

Let me clarify my question. I am not surveying your personal preferences. The technologies or products mentioned here tend to be very young and not widespread. It would be very unpleasant to discover, after investing months of code, that they are not yet ready or don’t fit production. So I would like to know (not your subjective tastes, but) if they are able to work in the environment described above.

antonio
  • 10,629
  • 13
  • 68
  • 136
  • 2
    I'm still not sure exactly what your question is. This seems to fall perfectly in the type of question [you should avoid asking here](http://stackoverflow.com/help/dont-ask). If you can turn it into an actual question I would advise that you make an attempt to do so. – Dason Jun 16 '13 at 02:39
  • @Dason: I am stalled as I need to start a new project (or say completing a project) and I wouldn't want to discover, after months of work, that I have taken the totally wrong path. I need to find a toolkit that works in production. Only a developer who's using/ed it can tell me. Please, suggest me how I could improve the question? – antonio Jun 16 '13 at 10:14
  • @antonio I just saw you tagged the question with `Rook`. Do you need your app to run only inside your office network? if so, `Rook` it's more than enough. I've been using it for a couple weeks and it's perfect if you don't need external access to the application. – Michele Jun 16 '13 at 10:14
  • @Michele: Yes, it is a standard desktop application, but using the browser as the GUI environment would please the end user. – antonio Jun 16 '13 at 10:23
  • @antonio That's perfect. Like I said. `Rook` it's the only thing you need. I can edit my answer with some example if you want. – Michele Jun 16 '13 at 10:28
  • 1
    `Rook` is a good choice. You might try prototyping with `gWidgetsWWW2` (on github) to see how you like it with extjs. You could use many other JavaScript options with it though. For desktop use, the `gWidgets` stuff can be used to make something quick and useful, but you mention months -- not days. For that scale, you should probably stick to the toolkits. `RGtk2` plus `cairoDevice` can get you really far (the `rattle` package is an example). These aren't exactly new kids on the block. – jverzani Jun 16 '13 at 17:01

2 Answers2

3

We have created a kind of webapp building on rApache and Ruby on Rails beside some other technologies at rapporter.net - that turned out to act rather a framework to host R-based statistical applications in the means of Rapplications instead of our initial goal to create a user-friendly online front-end to R. I'd warmly suggest to check out our features, as you might save tons of resources by not dealing with server-side, CMS and other boring issues, but could concentrate on the statistical tool.

Anyway, beside promoting our stuff, let me summarize my experiences:

  • rApache is definitely ready for production, but please note that only for rather stateless algorithms (by default Apache would start bunch of workers so the same user/client would end up interacting with different R sessions in each query). E.g. RServe would be a better alternative for a stateful application.
  • AFAIK Shiny server is meant to host dedicated statistical tools and applications -- just like our Rapplication service with or without DB backend -- with some customizable user input. You would need some technical skills to do so and also providing a (HA) environment might require way too much extra resources. This can be a huge advantage or disadvantage based on your requirements and expectations.
  • The hugest issue in such question should be security (like using RAppArmor or sandboxR), not just the R connector back-end, as users will interact with your servers (if hosted in the cloud). Desktop applications are a bit more developer-friendly, but supporting all major platforms can be a no-no in the era of tablets and smartphones. The cloud app can run on any device with a browser.
  • You should choose the optimal solution based on your requirements. There are bunch of tools ready for production, and each has its own advantages and special use cases. Just check out which related packages/applications are still under development with support, and answer a few questions like:
    • Is there any need to connect to databases?
    • What types of user input is needed (e.g. only parameters, datasets, R commands)?
    • Desktop/cloud app? Are you sure? If the later, would you like to care with the setup, maintenance and support?
    • Do you run any computational intensive tasks?
    • Do you want to implement an application to help users with repetitive and standardized tasks or rather providing a rather general and extensible software?
    • Do you need a responsive application with interactive setup or using that for reporting purposes?
    • What output formats do you need?
    • What other technologies are you familiar with? It's rather hard to built a Meteor-based app with a NoSQL backend if you worked with MySQL, PHP, Java or C# in the past.
daroczig
  • 28,004
  • 7
  • 90
  • 124
  • by the way if you fancy a 100 bounty :-) could you please give me some input on this http://stackoverflow.com/questions/17118048/getting-the-ip-address-of-an-rook-page-user you seem to be able to answer! – Michele Jun 17 '13 at 06:54
1

I'm about to do something similar. The fastest way ( in respect of both deployment time and future application performance) seems to be c# interfacing with R through R.NET. In Visual Studio you will benefit from incredible visualisation options with just few clicks, and setting up interactive/drill down charts it's quite straightforward too. As you also mentioned, RServe (with Java) is another valuable option.

EDIT

If a web application is not required to run on a public ip address the r package Rook it's an interesting option. Some example with Rook: using ggplot2, using googleVis

Michele
  • 8,563
  • 6
  • 45
  • 72
  • 1
    Thank you. I see that the HTML code is all in the R code. [Jeroen Ooms](http://www.stat.ucla.edu/~jeroen/files/seminar.pdf) suggests: “Don’t use R to generate Layout or HTML. This soon become unmanageble.” With `Rook` is it possible move the layout in separate HTML files, not generated with R scripts? – antonio Jun 16 '13 at 11:04
  • not sure but I think that seminar is not about `Rook` but `RApache` (and the app he means are huge :-) ). With `Rook` you create the `html` page with `res$write("...")`. At the moment, I actually needn't to follow that suggestion, the pure `html` code inside my web apps is small and they are mainly a user frindly front-end to enter some parameters, do queries, show tables, charts and calculation results. I also embed some `JavaScript` to validate fields and show alerts. However, you could add into your `R` generated `html` code a link to a `css` file and so having this separate. – Michele Jun 16 '13 at 11:23