R Server and Shiny
This post is authored by Carl Nan, Principle Program Manager at Microsoft.
With the release of Microsoft R Server (Version 9.0), Microsoft introduced a new set of capabilities to help enterprises deploy their R analytics into production environments. MRS 9.0 enabled R analytics to be exposed as web services so that they can be integrated with line of business apps written by any programming language.
Shiny, developed by R Studio, is a web application framework for R and it can also integrate R analyses into interactive web applications. R users have asked for guidance on how to think about the deployment features in Microsoft R Server and web application authoring capabilities in Shiny. This blog will compare them and provide guidance.
I will start the comparison from a technology perspective which will help us understand how R Server and Shiny integrate R with applications.
Microsoft R Server enables application integration by turning R code into web services so that applications written in any programming language can consume these R web services via RESTful API calls. These web services are wrapped with Swagger (the most popular API framework) to make this integration much easier and faster for app developers.
Figure 1: R Server exposes R code as web services to enable r and app integration
Shiny is a framework developed by RStudio to build interactive web applications straight from R. The app UI can be built entirely using R, and works in any R environment. In short, Shiny brings web app development into R, making it easy for data scientists who don't have the web development experience, to develop web applications that leverage R analytics.
R Server allows empowerment and collaboration between data scientists and application developers. Data scientists can remain focused on creating the best R code and models possible to harness the opportunity they are after; they don't have to worry about the intricacies of application development. The Line of Business programmer can stay focused on creating the best application possible without worrying about data science, but still leverage the excellent work the data scientists has created, through RESTful APIs. Thus, empowerment of each persona and collaboration between personas are enabled by Microsoft R Server.
Shiny, on the other hand, is targeted at only the data scientists. Data scientists in this case are expected to develop both R code and the web app. Shiny makes it easy by offering a framework to encapsulate web development into R functions.
Involving one more or one less persona in the app integration process doesn't imply strength or weakness of a product. R Server and Shiny are simply designed to serve different use cases.
Target Use Cases
R Server is designed for enterprises to integrate R analytics into their line of business (LOB) apps which could be already existing and could be written in various programming languages. In most cases, using R for prediction or visualization is only a small part of the LOB app. One sweet spot use case for R server could be: as a solution provider at an insurance company, you can enhance an existing customer support system to deliver real-time, high-quality policy quotes (via scoring / prediction with R models) to customers who contact your customer support center. This only requires the data scientist to create the right model. The developer working on the pre-existing LOB system can just augment his/her code to leverage the web services APIs from R, enabled through R Server.
Shiny is designed for data scientists to share their analysis result in an appealing and interactive way. With a short learning curve, it can enable R users to quickly implement dashboards, interactive reports etc. by using their familiar R language. You can use shiny on top of R Server too, since it is just another R package.
Can work together
R Server and Shiny are not mutually exclusive. They can work together by leveraging the strength from each other. For example, a data scientist team can use R Server to expose some commonly used R code as web services, and thus various Shiny apps can easily consume those services by just using R to do interesting things.
In summary, R Server and Shiny use different technologies to enable apps integration with R code. They target to different use cases and thus fit for different audiences. They are not mutually exclusive and in some cases, they can work together to create more value.
Figure 2 Summary of R Server and Shiny comparison