<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/production-r-at-ons/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://www.mango-solutions.com/wp/2017/02/production-r-at-ons/"> Mango Solutions » R Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div width="100%">Mark Sellors<br>
Head of Data Engineering</div>
<p><a target="_blank" rel="nofollow" href="http://www.ons.gov.uk/"><img alt="ons-logo" class="wp-image-6524" src="https://i2.wp.com/www.mango-solutions.com/wp/wp-content/uploads/2017/02/ons-logo2-1024x206.png?resize=456%2C91" data-recalc-dims="1"></a></p>
<p>I’ve recently been working at the <a target="_blank" rel="nofollow" href="https://www.ons.gov.uk/">Office for National Statistics</a>, under the very broad umbrella of a SAS to R transition project.</p>
<p>As you might imagine, ONS, as the UK’s largest producer of official statistics, has a huge number of internal statistical applications, so it’s not possible to “simply” switch from SAS to R. Working with various product owners and maintainers, a small team from Mango were able to perform a deep dive into a few of their existing applications which rely on SAS for statistical processing, and identify some likely candidates for proof of concept transitions.</p>
<p>The Mango team consisted of three individuals with skills covering Java and R development, business analysis, project management and architecture/infrastructure deployment. This combination was perfect for the task at hand, and we’ve delivered a solid foundation upon which ONS can build.</p>
<p>Mango had already prepared an initial report into the existing SAS usage within ONS as part of a prior exploratory project, so we were able to hit the ground running and make some very real gains over the course of the project. One of the applications we looked at, was an in-house developed, time-series analysis tool kit. This application is starting to show its age a little now, but is well used and understood, both within ONS and amongst their wide user-base. This application is broadly based around a <a target="_blank" rel="nofollow" href="https://en.wikipedia.org/wiki/Service-oriented_architecture">Service Oriented Architecture</a>, which in theory makes transitioning some of those services to R a snap, so we started here.</p>
<p>An internal PoC had already been conducted, where a small Java app had been wired in with an <a target="_blank" rel="nofollow" href="https://cran.r-project.org/package=Rserve">Rserve</a> based back-end. This convinced them that what they were thinking about would at least be possible, so ONS decided to take it further and bring Mango in to help.</p>
<p>The first thing to do was to get a demo environment built, so we requested a server, and installed R, lots of useful packages and <a target="_blank" rel="nofollow" href="https://www.rstudio.com/products/rstudio/download-server/">RStudio Server</a>, and <a target="_blank" rel="nofollow" href="https://www.rstudio.com/products/shiny/download-server/">Shiny Server</a>.</p>
<p>Next, we needed to decide on a way to present our R functions as a service that could be consumed over the network, in much the same way as the SAS ones could. For the sake of speed, simplicity, and flexibility, I suggested that we use <a target="_blank" rel="nofollow" href="https://github.com/trestletech">Jeff Allen’s</a> excellent <a target="_blank" rel="nofollow" href="http://plumber.trestletech.com/">plumber</a> package. I’ve <a target="_blank" rel="nofollow" href="http://blog.sellorm.com/talks">talked about plumber</a> quite a bit before, but for those of you who are unaware, plumber takes your R functions and makes them immediately available as a web API, which makes it a perfect fit for ONS. Jeff has also helpfully provided information about hosting plumber services on the project’s website.</p>
<p>At Mango, we’ve done variations of this project many times, but this specific occasion offered us the chance to really explore the limits of what we could achieve with plumber, and I’m really happy to report that it exceeded expectations substantially.</p>
<p>There are implementation details that I won’t bore you with, but at a high level, we were able to take Jeff’s existing instructions and expand on them to suit our needs with ease. Along the way we’ve encountered and solved a few problems, but in general we were able to implement a complete platform based around a microservice architecture, with individual services written in R using the plumber package.</p>
<p>In the time-series application for example, we were able to demonstrate the replacement of two existing SAS services, with ones written in R. We made some modifications to the Java app itself, re-implemented two of the existing SAS services in R, and then served that using multiple plumber instances and a load balancer, to demonstrate how it would work in a production setting.</p>
<p>I’ll be sharing more details about exactly what we did, in future posts, so look out for those, but for now, I’d encourage you to investigate plumber and see if it has a place in your business!</p>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://www.mango-solutions.com/wp/2017/02/production-r-at-ons/"> Mango Solutions » R Blog</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/1sgJn1HIyHg"></a></div>