Home » Uncategorized

Building Shiny Apps: Tutorial

This article was posted by Dean Attali. Dean is currently an R-Shiny consultant.

Shiny is a package from RStudio that can be used to build interactive web pages with R. While that may sound scary because of the words “web pages”, it’s geared to R users who have 0 experience with web development, and you do not need to know any HTML/CSS/JavaScript.

You can do quite a lot with Shiny: think of it as an easy way to make an interactive web page, and that web page can seamlessly interact with R and display R objects (plots, tables, of anything else you do in R). To get a sense of the wide range of things you can do with Shiny, you can visit my Shiny server, which hosts some of my own Shiny apps.

This tutorial is a hands-on activity complement to a set of presentation slides for learning how to build Shiny apps. In this activity, we’ll walk through all the steps of building a Shiny app using a dataset that lets you explore the products available at the BC Liquor Store. The final version of the app, including a few extra features that are left as exercises for the reader, can be seen here (see screenshot below.) Any activity deemed as an exercise throughout this tutorial is not mandatory for building our app, but they are good for getting more practice with Shiny.

2808326731

2808326810

This tutorial should take approximately an hour to complete. If you want even more practice, another great tutorial is the official Shiny tutorial. RStudio also provides a handy cheatsheet to remember all the little details after you already learned the basics.

Table of contents

  1. Before we begin
  2. Shiny app basics
  3. Create an empty Shiny app
  4. Load the dataset
  5. Build the basic UI
  6. Add inputs to the UI
  7. Add placeholders for outputs
  8. Checkpoint: what our app looks like after implementing the UI
  9. Implement server logic to create outputs
  10. Reactivity 101
  11. Using uiOutput() to create UI elements dynamically
  12. Final Shiny app code
  13. Share your app with the world
  14. More Shiny features to check out
  15. Awesome add-on packages to Shiny
  16. Resources
  17. Ideas to improve our app

To check out all this information, click here.

DSC Resources

Follow us on Twitter: @DataScienceCtrl | @AnalyticBridge

Leave a Reply

Your email address will not be published. Required fields are marked *