Install the flexdashboard package from CRAN as follows:
To author a flexdashboard you create an R Markdown document with the
flexdashboard::flex_dashboard output format. You can do this from within RStudio using the New R Markdown dialog:
If you are not using RStudio, you can create a new
flexdashboard R Markdown file from the R console:
rmarkdown::draft("dashboard.Rmd", template = "flex_dashboard", package = "flexdashboard")
You can use flexdashboard to publish groups of related data visualizations as a dashboard. A flexdashboard can either be static (a standard web page) or dynamic (a Shiny interactive document). A wide variety of components can be included in flexdashboard layouts, including:
R graphical output including base, lattice, and grid graphics.
Tabular data (with optional sorting, filtering, and paging).
Value boxes for highlighting important summary data.
Gauges for displaying values on a meter within a specified range.
Text annotations of various kinds.
See the dashboard components documentation for additional details on the use of each component type.
Single Column (Fill)
Dashboards are divided into columns and rows, with output components delineated using level 3 markdown headers (
###). By default, dashboards are laid out within a single column, with charts stacked vertically within a column and sized to fill available browser height. For example, this layout defines a single column with two charts that fills available browser space:
To lay out charts using multiple columns you introduce a level 2 markdown header (
--------------) for each column. For example, this dashboard displays 3 charts split across two columns:
In this example we’ve moved Chart 1 into its own column which it will fill entirely. We’ve also given the column a larger size via the
data-width attribute to provide additional emphasis to Chart 1.
You can also choose to orient dashboards row-wise rather than column-wise by specifying the
orientation: rows option. For example, this layout defines two rows, the first of which has a single chart and the second of which has two charts:
The Using page includes documentation on all of the features and options of flexdashboard, including layout orientations (row vs. column based), chart sizing, the various supported components, theming, and creating dashboards with multiple pages.
The Shiny page describes how to create dashboards that enable viewers to change underlying parameters and see the results immediately, or that update themselves incrementally as their underlying data changes.
The Layouts page includes a variety of sample layouts which you can use as a starting point for your own dashboards.
The Examples page includes several examples of flexdashboard in action (including links to source code if you want to dig into how each example was created).