Data can be transformative when loaded through business intelligence software for strategic decision-making. The insights generated empower businesses to improve their processes, initiatives, and innovations. But can we improve the way business decision-makers access these insights? Enter the world of dashboards in R Shiny and see how RStudio and open source is revolutionizing business intelligence.
Table of Contents
- What is a dashboard?
- What is Shiny?
- Why use dashboards?
- Why build dashboards in R Shiny
- Examples of dashboards in R Shiny
- R Shiny dashboard framework
- Create R Shiny dashboards with Appsilon Templates
What is a dashboard?
Dashboards are tools that provide up-to-date information, using visuals to communicate the stories behind the data. They guide decision-makers through the relationships of complex, big data. They present visuals in a practical order enabling quicker understanding and appreciation of data to the business.
What is Shiny?
Shiny is an open source R package from the team at RStudio, PBC. RStudio built Shiny to provide an elegant and easy-to-use web framework for developing web applications in R. Shiny enables R users to create incredible apps, interactive maps, and dashboards. And you don’t need advanced web dev skills to build it!
“Shiny combines the computational power of R with the interactivity of the modern web.” – RStudio
Share the story behind your data with quick builds and a variety of hosting and deployment options from RStudio. Deploy to the cloud to services like AWS with RStudio Workbench, use open source options for private projects, or use RStudio Connect to upgrade your Shiny Dashboard for enterprise applications.
Why use dashboards?
- Timely information – Present critical information in an organized and compact way. Helping decision-makers identify the most valuable answers to decision-related questions.
- Access critical insights – Track key performance indicators and trends in sales data, all derived from a variety of data sources.
- Improve performance – It’s a window to visualize trends and monitor business metrics.
- Customization and scale – Fit the needs of individual user roles, departmental requirements, or an entire organization. Improve efficiency in business processes while maintaining brand consistency.
- Collaboration – Build an interface for collaboration with concurrent users. Enable teams to work together.
Why build dashboards in R Shiny?
Shiny dashboards let you access a complete web application framework within the R environment. Easily turn your work in R, analyses and visualizations, machine learning models, and more into web applications that deliver value to businesses. As a complete application, end-users don’t need an understanding of R to use it. Deliver a complete, easy-to-use, and interactive product that improves the way you do business.
Appsilon builds R Shiny applications for Fortune 500 companies. R and Shiny aren’t the best fit for everyone, but for those looking to solve tough problems with big data, consider adding R Shiny to your tech stack. Explore why companies are switching to R Shiny and why you should too.
Custom Shiny dashboards
Shiny is open source and cost-friendly compared to its counterparts like Power BI and Tableau. You can explore a comprehensive look comparing Power BI to Shiny and Tableau to Shiny on the Appsilon blog.
Don’t want to part with Tableau? Don’t worry – you can now create Tableau Dashboard extensions with R Shiny.
RStudio provides easy-to-use deployment options that range from completely free to low-cost options with additional benefits including security and authentication, scaling, and performance reviews. The ease of deployment as a standalone app to analyze, summarize, and visualize your data story without breaking your budget is hard to beat.
Open Source and accessibility
Looking at the architecture of the Shiny dashboard, the use of functions, modules, and packages, and rapid-prototyping helps in the management and organization of code. You can create smaller, manageable, and testable components of the dashboards and simple source code controls.
Examples of dashboards in R Shiny
Appsilon has built Shiny dashboards for Fortune 500 companies, NGOs, non-profits, and governments. Over the years they’ve built a showcase of professional and unique Shiny dashboards. RStudio also houses contributions from the Shiny app developer community on their Shiny Gallery. I’ve selected a few examples below:
Check out these 5 Shiny dashboards developed for enterprises and decision-makers.
Shiny dashboard in Health Care
Christian Luz developed the Shiny app below in “the context of a 1339-bed academic tertiary referral hospital to handle data of more than 180,000 admissions.” The app contains 17 unique criteria from which users can filter patient groups. Users can investigate the use of antimicrobials, microbiological diagnostics, and antimicrobial resistance. Easily stratify and group the results of the investigation “to compare defined patient groups based on individual patient features.”
Shiny dashboard in Government
The Shiny dashboard below shows the New Zealand Trade Intelligence Dashboard. The dashboard shows up-to-date annual information on trade by commodities, services, and trading partners. Wei Zhang used intuitive, interactive graphs and tables to provide powerful functionality. Users can generate their own reports for different commodities and market groups. Wei Zhang developed and designed the dashboard for both PCs and mobile devices.
R Shiny dashboard framework
A Shiny application project is made up of a directory containing an R script saved as app.R. The script consists of code describing two components – the user interface object and the server function. Both of which are passed as arguments to the shinyApp function. Resulting in the creation of a Shiny app object either a web app or dashboard.
Note these two components – the UI/server pair can also be split into two separate files namely: ui.R and server.R. The project folder may also contain additional files relating to data, scripts, styles, or other resources required for deployment.
The ui.R, user interface function, contains code that defines how the dashboard looks containing the input and output controls. The server.R, server function containing code, defines how the dashboard works sending back the outputs and interacting with the input values. Shiny uses reactive programming to automatically update outputs when inputs change while the dashboard is running.
Create R Shiny dashboards with Appsilon templates
Appsilon recently release a bundle of Shiny dashboard templates that are free use and customizable. The best and most fun part is – it’s so easy to customize and deploy within minutes, no matter your development environment.
Appsilon selected the Shiny dashboards based on elements that are customizable and relevant to many projects. The goal is to encourage R Shiny adoption for dashboards and other applications by showcasing the ease of use and customization. The bundle contains four applications that we can select from based on our project.
Downloading R Shiny Dashboards
First, we download the templates as a zip file from Appsilon Shiny Dashboard Templates. Fill out the form on the page to your local computer. Extract the zip file and save it in your preferred directory.
For this demo, we’ll use the Destination Overview. Let’s open each of the projects in RStudio. You might get a response like the one below:
It means we don’t have all dependencies used during the development of the templates. To fix this, we need to restore the R environment from the `renv` folder by running the command below from the R console:
Executing this code takes a little while to complete. There might be several packages to download and install to get the environment right. Once we have successfully completed this step, we can run the app by opening either ui.R or server.R and clicking the Run App button. The resulting dashboard is what you see below:
Finally, we can deploy the resulting R Shiny Dashboard freely on shinyapps.io. If you don’t have one already, you’ll need to register an account using your preferred email, Google, or GitHub credentials.
You’ll need to install the `rsconnect` package in RStudio and using the console, add your shinyapps.io credentials (name, token, and secret key) for authentication through the console. Use the code below to complete this process:
Dashboards in R Shiny
In summary, dashboards play a key role in business intelligence and analytics. Dashboards are a window to understand and track business metrics through different sources, sizes, and types of data. Dashboards simplify the decision-making process and collaboration among users. Data scientists don’t need to spend time explaining the results and consumers quickly understand the data story. And the availability of Shiny dashboards on the web or mobile platforms gives users more mobility and accessibility.
Learn how to build, style, scale, and deploy Shiny dashboards with our R Shiny Masterclass.