# Is R viable for production (deployed) code

I have read a number of articles that talk about companies such as Google, Facebook, and many others using R for research. The other scenario I have read about is companies using R to prototype an analytics solution and then re-implement it in another language.

I am trying to find literature on companies using R for actual production analytics code. A use case might be a recommender system that user interacts with via a web page that gets a response from an R script executed on a remote server. The fact that I am having trouble finding such reports makes me wonder if it is unadvisable. If so why?

-
This is a good question. I have a hunch, but I don't know enough to make this an actual answer. My suspicion is that because R is distributed under the GPL, any derivative products using it must be free and open-source as well. This may mean companies wishing to make a profit from enterprise software would steer away from R because they would not be able to sell the product. –  gmacfarlane Oct 11 '12 at 22:14
Only if your profit is based on selling the software---and even then, some people still give the software away as e.g. RStudio whose source code is on github. –  Dirk Eddelbuettel Oct 11 '12 at 23:15

Yes it is. Look for example at this page for the wonderful headless RServe R server instance (by R Core member Simon Urbanek) which lists these deployments:

Some projects using Rserve:
The Dataverse Network Project   Phenyx                     "J" interface
Nexus BPM                       Taverna                    Bio7
INTAMAP                         Screensaver HTS LIMS       CRISP
WWARN


with links at the page referenced above.

"Industry" tends to be more cagey about details than academia, so you will be hardpressed to find "official" statements. But vendors like Revolution Analytics or Oracle ship R and their salesmen may have stories for you....

-
+1 for salesmen. Say you're interested in buying something, and a fair number of salespeople will give out their CEO's SSN. –  Fomite Oct 11 '12 at 21:56
Thanks Dirk. RServe looks very useful. –  drobs Oct 12 '12 at 14:23

Typically not as R is an interpreted language, which on average is many times slower than equivalent compiled code. While converting your program to C, Fortran, or Java takes a significant investment, the code can literally run 10-100X faster than an equivalent R version. Additionally, R has very limited tools to manipulate large datasets, especially ones that require clusters to process or require special hardware. Moreover, most commercial implementations need to provide user interfaces and fit into existing frameworks, which are typically written in other languages. While you could interface with existing R code from most compiled languages (there are wrappers out there), you would find that your core numerical routines would still not be any faster than the original R code. At the end of the day, R (like Matlab) is used mostly for prototyping and/or trying out ideas using existing implementations.

-
>(...)the code can literally run 10-100X faster than an equivalent R version I don't agree. Almost all R libraries are written in C or Fortran. The R works mostly as a "glue" between them, and its relative poor performance doesn't count. –  Adam Ryczkowski Oct 12 '12 at 11:00
Not true. While the core library may be written in C, most high level algorithms in R are written in R. JIT optimization is changing the rules with regards to the performance of interpreted languages versus compiled languages, but as far as I know there is no effort along these lines underway for R (Python does have a robust effort: see PyPy). –  user1337732 Oct 13 '12 at 1:10