Data-driven Apps with R Shiny
When talking about data products in Business Intelligence, people often only consider ‘static’ deliverables like reports and dashboards. In our experience, experts need to interact with their data, change the input and see how the output changes. Think about planning optimization analysis, revenue simulations, and customer churn predictions.
A lot of organisations are missing these solutions in their data landscape, others have built custom solutions in Excel or Access, but are running into issues sharing and maintaining them.
The ideal solution to these requirements are data-driven apps. In this blog post we share some insights in how we build data-driven applications for our customers at LoQutus.
What are data-driven apps?
In data-driven applications, the flow is determined by the data that is processed. Users interact with the app and inputs from users change the way the application behaves.
Data-driven apps have the following characteristics:
- Their main goal is interacting with data (as opposed to handling business events in transactional systems).
- The users can manipulate inputs to see the effect on certain outputs.
- They can modify assumptions by fine-tuning the input parameters and run simulations for different scenarios.
- The apps operate on diverse data from many multi-channel data sources.
When to use data-driven apps?
Business managers rely on IT departments to set up a BI environment that delivers relevant business insights to them. Business experts with high data affinity tend to develop their own solutions using software installed on their laptops. They clean input files and combine them in MS Excel or MS Access.
At a certain point, the limits of these ‘homemade’ applications are reached. Issues often lie hidden within the complexity of managing the algorithm and calculations. Or they may arise when versioning the solution, refreshing data, or sharing results with others.
Data-driven apps have the potential to replace some of these isolated solutions. These apps have the advantage that they can be developed in close collaboration between business experts and data analysts. Often there is no need to include UX specialists or web developers, leading to much lower development costs.
Given that there are also no licence costs for open-source packages, they offer a quick way to get a first iteration ready that delivers the business value. Results can be shared in a flexible manner, leaving possibilities for end users to play around with the model’s parameters.
Leveraging R for Data-Driven Apps
As part of our data analysis activities, we often go to R or Python to leverage their rich ecosystem of data analysis libraries. Today we’ll focus on how we build data-driven apps with R. R is a programming language and free software environment that is ideal for data cleaning, data preparation, data analysis and data visualization. R allows to import data from external sources like text files, MS Excel files and databases.
As R is open source and perfectly suited for data analysis, it is often used by data analysts to build calculation models. The R code is run on the analyst’s personal computer. Sharing the model results is possible by exporting to MS Excel, MS PowerPoint, PDF, etc. However, these results are static reports, which prevent users from interacting with the calculation model.
R comes with a Shiny library that is suited to create interactive data-driven applications. R Shiny overcomes aforementioned drawbacks of static reporting. R Shiny applications typically start from an empty template layout like header, sidebar and body; on which the user interface elements can be positioned. The elements consist of inputs and outputs.
Input options are numerous: text input, numeric input, checkboxes, radio buttons, select boxes, sliders, slider ranges, hands on table etc. File input is also possible, feeding the app with a new data set from a user’s file in a pre-defined template layout.
The input values are captured by the app and can be used to filter data or as input for calculations. The output results can be displayed in graphs, tables, images, text format, etc. Multiple libraries like ggplot2, plotly, etc. let users create their own custom graph layouts.
Advantages of R Shiny data-driven apps
- The analyst can develop the data-driven app in the R language he is already familiar with.
- Complex calculations with limited coding by leveraging the power of R.
- Large community with abundant choice of existing libraries to re-use code:
- Built-in widgets to create user-friendly screens in the shiny library
- Libraries for data cleaning and preparation e.g. dplyr, tidyr, etc.
- Libraries for data analysis and machine learning
- Libraries for data visualisation e.g. ggplot2, plotly, etc.
- The apps can be built by data analysts, there is no need to include UX specialists.
- Quick prototyping of the app.
- Several (production-grade) deployment options are available, like Shinyapps.io, Shiny Server Pro or the open-source ShinyProxy (our favorite).
Real life example – Healthcare Analytics
Together with Möbius, LoQutus developed a data-driven app for hospitals to optimize capacity through their healthcare value chain. The app allows hospitals to benchmark their performance versus the best-in-class and versus the industry average.
How can LoQutus assist you?
Are you in need for data-driven apps? LoQutus offers an end-to-end solution. Together we identify the right use cases. We architect the right data environment for your organization. We can kickstart the solution to your key challenges by designing, building, and implementing the data-driven application(s). Finally we assist by giving the necessary training and support so you can build the necessary competences within your organization.
For more information, please contact our Analytics & Insights team:
Written by Stijn Vannieuwenborgh, Data Analyst at LoQutus.