Dashboards in R Shiny

Estimated time:

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 <ul><li><a href="#dashboard">What is a dashboard?</a></li><li><a href="#rshiny">What is Shiny?</a></li><li><a href="#using">Why use dashboards?</a></li><li><a href="#build">Why build dashboards in R Shiny</a></li><li><a href="#examples">Examples of dashboards in R Shiny</a></li><li><a href="#framework">R Shiny dashboard framework</a></li><li><a href="#templates">Create R Shiny dashboards with Appsilon Templates</a></li><li><a href="#conclusion">Conclusion</a></li></ul> <hr /> <h2 id="dashboard">What is a dashboard?</h2> 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. <h2 id="rshiny">What is Shiny?</h2> Shiny is an open source R package from the team at <a href="https://shiny.rstudio.com/" target="_blank" rel="noopener noreferrer">RStudio, PBC</a>. 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! <blockquote>"Shiny combines the computational power of R with the interactivity of the modern web." - RStudio</blockquote> 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 <a href="https://appsilon.com/deploying-rstudio-workbench-to-aws-using-terraform/">AWS with RStudio Workbench</a>, use open source options for private projects, or use RStudio Connect to upgrade your <a href="https://appsilon.com/why-you-should-use-r-shiny-for-enterprise-application-development/" target="_blank" rel="noopener noreferrer">Shiny Dashboard for enterprise applications</a>. <h2 id="using">Why use dashboards?</h2><ul><li style="font-weight: 400;" aria-level="1"><b>Timely information</b> - Present critical information in an organized and compact way. Helping decision-makers identify the most valuable answers to decision-related questions. </li><li style="font-weight: 400;" aria-level="1"><b>Access critical insights</b> - Track key performance indicators and trends in sales data, all derived from a variety of data sources. </li><li style="font-weight: 400;" aria-level="1"><b>Improve performance</b> - It’s a window to visualize trends and monitor business metrics.</li><li style="font-weight: 400;" aria-level="1"><b>Customization and scale</b> - Fit the needs of individual user roles, departmental requirements, or an entire organization. Improve efficiency in business processes while maintaining brand consistency.</li><li style="font-weight: 400;" aria-level="1"><b>Collaboration</b> - Build an interface for collaboration with concurrent users. Enable teams to work together.</li></ul> <h2 id="build">Why build dashboards in R Shiny?</h2> 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. <p class="graf graf--p">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 <a class="markup--anchor markup--p-anchor" href="https://appsilon.com/why-you-should-use-r-shiny-for-enterprise-application-development/" target="_blank" rel="noopener noreferrer" data-href="https://appsilon.com/why-you-should-use-r-shiny-for-enterprise-application-development/">why companies are switching to R Shiny</a> and why you should too.</p> <h3>Custom Shiny dashboards</h3> Shiny’s web framework enables easy customization of the dashboard using custom HTML, CSS, SCSS, Javascript, and so on. This level of customization lets you create a unique, branded dashboard that’s not possible with other BI software suites. Add colors, logos, fonts, and more that better represent your business. <h3>Cost</h3> Shiny is open source and cost-friendly compared to its counterparts like Power BI and Tableau. You can explore a comprehensive look comparing <a href="https://appsilon.com/powerbi-vs-r-shiny/">Power BI to Shiny</a> and <a href="https://appsilon.com/tableau-vs-r-shiny/">Tableau to Shiny</a> on the Appsilon blog. <blockquote>Don't want to part with Tableau? Don't worry - you can now <a href="https://appsilon.com/r-shiny-shinytableau/">create Tableau Dashboard extensions with R Shiny</a>.</blockquote> RStudio provides <a href="https://www.rstudio.com/products/shinyapps/#ShinyApp" target="_blank" rel="noopener noreferrer">easy-to-use deployment </a>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. <h3>Open Source and accessibility</h3> Shiny as a development platform for dashboards gives you access to a wealth of R packages for data science like the <a href="https://www.tidyverse.org/" target="_blank" rel="noopener noreferrer">Tidyverse</a>. You can access advanced graphical features for data and model representation.  Embed these visuals on Shiny dashboards and add interactivity and responsiveness. You can achieve this through an interface enabled in R to connect with plotting libraries based on JavaScript.  Looking at the architecture of the Shiny dashboard, the use of functions, modules, and packages, and rapid prototyping help in the management and organization of code. You can create smaller, manageable, and testable components of the dashboards and simple source code controls. <h2 id="examples">Examples of dashboards in R Shiny</h2> Appsilon has built Shiny dashboards for Fortune 500 companies, NGOs, non-profits, and governments. Over the years they've built a showcase of <a href="https://demo.appsilon.com/">professional and unique Shiny dashboards</a>. RStudio also houses contributions from the Shiny app developer community on their <a href="https://shiny.rstudio.com/gallery/" target="_blank" rel="noopener noreferrer">Shiny Gallery</a>. I've selected a few examples below: <blockquote>Check out these <a href="https://appsilon.com/5-great-shiny-dashboards/">5 Shiny dashboards developed for enterprises and decision-makers</a>.</blockquote> <h3>Shiny dashboard in Health Care</h3> Christian Luz developed the <a href="https://shiny.rstudio.com/gallery/hospital-data-antimicrobial.html" target="_blank" rel="noopener noreferrer">Shiny app</a> below in “<i>the context of a 1339-bed academic tertiary referral hospital to handle data of more than 180,000 admissions</i>.” 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.” <img class="size-full wp-image-11722 aligncenter" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01e9e9722a2d259a28589_RadaR.webp" alt="RadaR Shiny Dashboard" width="1600" height="654" /> &nbsp; <h3>Shiny dashboard in Government</h3> The Shiny dashboard below shows the <a href="https://shiny.rstudio.com/gallery/nz-trade-dash.html" target="_blank" rel="noopener noreferrer">New Zealand Trade Intelligence Dashboard</a>. 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. <img class="size-full wp-image-11720 aligncenter" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01e9f04abfeee1f05227c_NZ-Trade-Intelligence.webp" alt="NZ Trade Government Shiny Dashboard" width="1600" height="820" /> &nbsp; <h2 id="framework">R Shiny dashboard framework</h2> 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. <script src="https://gist.github.com/BAderinto/bdd044556e06f125023027c53c3fb5e2.js"></script> 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. <h2 id="templates">Create R Shiny dashboards with Appsilon templates</h2> 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. <img class="size-full wp-image-11724 aligncenter" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01ea18470194980456c9c_templates_appsilonblue-600x361-1.webp" alt="Appsilon Shiny Dashboard templates" width="600" height="361" /> &nbsp; <h3>Downloading R Shiny Dashboards</h3> First, we download the templates as a zip file from <a href="https://templates.appsilon.com/">Appsilon Shiny Dashboard Templates</a>. Fill out the form on the page to download on your local computer. Extract the zip file and save it in your preferred directory.   For this demo, we’ll use the <a href="https://demo.appsilon.com/apps/destination_overview/">Destination Overview</a>. Let’s open each of the projects in RStudio. You might get a response like the one below: <img class="alignnone size-full wp-image-11726 aligncenter" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01ea383f54e0b0d33baf9_warning-message.webp" alt="warning message" width="1530" height="220" /> &nbsp; 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: <script src="https://gist.github.com/BAderinto/9741f3579a78d5ef7f13dbf80f8cb874.js"></script> 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 <i>Run App</i> button.  The resulting dashboard is what you see below: <img class="size-full wp-image-11718 aligncenter" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01ea3cd7330b395c67bec_image.webp" alt="Destination Overview Dashboard code panel view" width="1600" height="870" /> &nbsp; Finally, we can deploy the resulting R Shiny Dashboard freely on <a href="https://www.shinyapps.io/">shinyapps.io</a>. If you don’t have one already, you’ll need to register an account using your preferred email, Google, or GitHub credentials. <script src="https://gist.github.com/BAderinto/aaa68b7514e5eadb3e8589def8d06677.js"></script> 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: <script src="https://gist.github.com/BAderinto/6b0e7aaac236e305820c6589f44e4169.js"></script> <h2 id="conclusion">Dashboards in R Shiny</h2> 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. Shiny can also be neatly integrated into the development pipeline of data professionals using R. Shiny dashboards are versatile, interactive, and easily customized to meet the specific needs of each customer. This is in part due to its web framework that allows the use of web technologies like HTML, CSS, SCSS, JavaScript, and so on. Using Shiny enables the use of modularised codes and functions, rapid prototyping, and easy means of managing the dashboards through smaller components. <blockquote> <p class="graf graf--p">Learn how to build, style, scale, and deploy Shiny dashboards with our <a class="markup--anchor markup--p-anchor" href="https://appsilon.com/shiny-masterclass-video/" target="_blank" rel="noopener noreferrer" data-href="https://appsilon.com/shiny-masterclass-video/">R Shiny Masterclass</a>.</p> </blockquote>

Contact us!
Damian's Avatar
Damian Rodziewicz
Head of Sales
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Have questions or insights?
Engage with experts, share ideas and take your data journey to the next level!
Join Slack
Explore Possibilities

Take Your Business Further with Custom Data Solutions

Unlock the full potential of your enterprise with our data services, tailored to the unique needs of Fortune 500 companies. Elevate your strategy—connect with us today!

Estimate Project
shiny dashboards