05:00
Dashboards visualize key data on demand
Turn an R Markdown document into an interactive dashboard
Open 04 – Dashboards.Rmd to work with a draft COVID19 flexdashboard. This file will look a little different than your previous Quarto files. Don’t fret – this R Markdown file works the same as Quarto! Do the following:
Click “yes” when you are finished!
05:00
Start with some ordinary ggplot code:
ggplot(data = data_frame) +
geom_function(mapping = aes(mappings))
Save that as my_plot
, then add some plotly magic …
my_plot <- ggplot(data = data_frame) +
geom_function(mapping = aes(mappings))
ggplotly(my_plot)
Return to 04 – Dashboard.Rmd.
Make the Test Volumes Over Time plot interactive.
Knit the document again to note the change. Hover over the interactive plots. Note what happens when you click on the various buttons that appear above the plot.
Click “yes” when you are finished.
03:00
Start with a regular data frame:
covid_testing
And pipe that to datatable()
from the DT package:
covid_testing %>% datatable()
Return to 04 – Dashboards.Rmd. Let’s try to display a list of positive results in the Details of Positive Test Results area of the plot.
covid_testing
data frame but doesn’t actually filter for positive results. Add to the pipeline a filter()
statement that selects only those rows where the result value is “positive” (Hint: “positive” must be in quotes). Knit () the dashboard and note the change.datatable()
function, we first need to load the DT package. Add a line to the setup chunk (all the way on top!) to load the DT package.03:00
---
title: "My Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: rows
theme: cerulean
---
Turn R Markdown documents into interactive dashboards with flexdashboard
Turn ggplot objects into interactive plots with plotly
Turn data frames into interactive tables with DT
A framework for developing interactive web applications in R: deploy in shinyapps.io, Shiny Server, or RStudio Connect.
Our next topic is:
Arcus Education / Children’s Hospital of Philadelphia (CHOP) R User Group