Overview

This lesson is meant to be a cursory look at creating interactive dashboards using RMarkdown + flexdashboard with Shiny integration. Roughly we will…

  1. Introduce and discuss interactive sites
  2. Overview of flexdashboard and its layout scheme
  3. Create a dashboard with static interaction (does not rely on Shiny)
  4. Create a dashboard with dynamic interaction (does rely on Shiny)
  5. Discuss options for themes and styles
  6. Publish the site

A note on Shiny: The focus of this lesson is integrating elements of Shiny through the RMarkdown interface via flexdashboard, which is different than learning classic Shiny via the shiny package. More standard tutorials for learning Shiny, such as Posit’s introduction, can show you how to build an app without flexdashboard. Personally, I think learning Shiny via flexdashboard is a good gateway, as it introduces some (but not all) of the concepts needed for more advanced app-building.

Set up

Package installation

It will be useful to make sure the following packages are installed, especially if your computer is sometimes buggy downloading packages.

install.packages('tidyverse')
install.packages('palmerpenguins')
install.packages('plotly')
install.packages('flexdashboard')
install.packages('shiny')
# worry less about...
install.packages('networkD3')

Make a shinyapps.io account

If you want to actually publish the page we make in this lesson, you will need to create a Shiny account and link it to your RStudio. To do this, please complete the following steps:

  1. create a Shiny account
  2. Follow the instructions for publishing in RStudio by navigating to Tools > Global Options > Publishing.

Once on this pane, you’ll click Connect > shinyapps.io and follow the instructions to link your account.

Review conditionals

This is not essential, but one of the trickiest parts of making documents interactive is setting the right conditionals for re-shaping your data. I would recommend revisiting the logic behind conditional statements in R, which include if...else, ifelse(), and case_when() functions. This tutorial will use the if...else syntax, so maybe worth brushing up on.