Chapter 5 Dashboards
R Markdown is customizable and extensible. In Chapters 3 and 4, we have introduced basic document and presentation formats in the rmarkdown package, and explained how to customize them. From this chapter on, we will show several more existing extension packages that bring different styles, layouts, and applications to the R Markdown ecosystem. In this chapter, we introduce dashboards based on the flexdashboard package (Iannone, Allaire, and Borges 2020).
Dashboards are particularly common in business-style reports. They can be used to highlight brief and key summaries of a report. The layout of a dashboard is often grid-based, with components arranged in boxes of various sizes.
With the flexdashboard package, you can
Use R Markdown to publish a group of related data visualizations as a dashboard.
Embed a wide variety of components including HTML widgets, R graphics, tabular data, gauges, value boxes, and text annotations.
Specify row or column-based layouts (components are intelligently re-sized to fill the browser and adapted for display on mobile devices).
Create story boards for presenting sequences of visualizations and related commentary.
Optionally use Shiny to drive visualizations dynamically.
To author a dashboard, you create an R Markdown document with the flexdashboard::flex_dashboard
output format. You can also create a document from within RStudio using the File -> New File -> R Markdown
dialog, and choosing a “Flex Dashboard” template.
If you are not using RStudio, you can create a new flexdashboard
R Markdown file from the R console:
::draft(
rmarkdown"dashboard.Rmd", template = "flex_dashboard",
package = "flexdashboard"
)
The full documentation of flexdashboard is at https://rmarkdown.rstudio.com/flexdashboard/. We will only cover some basic features and usage in this chapter. Dashboards have many features in common with HTML documents (Section 3.1), such as figure options (Section 3.1.5), appearance and style (Section 3.1.4), MathJax equations (Section 3.1.8), header and before/after body inclusions (Section 3.1.10.2), and Pandoc arguments (Section 3.1.10.5), and so on. We also recommend that you take a look at the R help page ?flexdashboard::flex_dashboard
to learn about more features and options.
References
Iannone, Richard, JJ Allaire, and Barbara Borges. 2020. Flexdashboard: R Markdown Format for Flexible Dashboards. http://rmarkdown.rstudio.com/flexdashboard.