Starting with Flexdashboard

Miguel Ángel Daza

April 9, 2019

INDEX

- Structure of a dashboard.

- Static dashboard.

- Dynamic dashboard.

Note: The content of this presentation has been obtained from the websites R Markdown from RStudio , Flexdashboard for R and R Markdown: The Definitive Guide.

FLEXDASHBOARD

Dashboards are a useful way to communicate large amounts of information visually and quickly. Create one with the flexdashboard::flex_dashboard output format, as in the .Rmd file.

Flexdashboard makes easy to organize your content into a visual layout:

Another way to indicate the 3 levels

Another way to indicate the 3 levels

FEATURES:

LAYOUT

There are many examples of layouts in Flexdashboard for R.

Many of them must be added to the Rmarkdown yaml-header.

One could set the design:
- in rows orientation: rows,
- or in columns orientation: columns.

Furthermore, you can decide if you want: - to fit the content in a page, - or to use scrolling websites vertical_layout: scroll.

Other possibility is to create a storyboard storyboard: true.

For Shiny features, runtime: shiny must be added. Then, we can include a sidebar by Sidebar {.sidebar}: - global at the level of the page, - or local at the level of the row or column.

Also, it is possible to create tabs: - in rows, when define a new one, Row {.tabset .tabset-fade}, - in columns, when define a new one, Column {.tabset}.

- STRUCTURE OF DASHBOARD

Note: All of this examples has been obtained from the website Flexdasboard for R.

VALUE BOXES

If you add the next R code, a value box is displayed.

### Primary
NumsWifi = 10
valueBox(NumsWifi, icon = "fa-wifi", color="primary")

There are five colors that correspond to the text:
- blue -> primary,
- violet -> info,
- gray -> success,
- orange -> warning,
- Red -> danger.

More examples of value boxes

More examples of value boxes

GAUGES

The next code produces a gauge (Shiny is needed, runtime: shiny).

### Contact Rate
gauge(91, min = 0, max = 100, symbol = '%', gaugeSectors(
  success = c(80, 100), warning = c(40, 79), danger = c(0, 39)
))

There are three colors that correspond to the text:
- green -> success,
- orange -> warning,
- Red -> danger.

More examples of gauges

More examples of gauges

- STATIC DASHBOARD

Note: All of this examples has been obtained using data file LogFile_corrected.csv

SHINY (use)

Using Shiny with flexdashboard turns a static R Markdown report into an Interactive Document.
It is important to note that interactive documents need to be deployed to a Shiny Server to be shared broadly (whereas static R Markdown documents are standalone web pages that can be attached to emails or served from any standard web server).

Note that the shinydashboard package provides another way to create dashboards with Shiny.

SHINY (How to Start)

The steps required to add Shiny components to a flexdashboard are as follows:

SHINY (Render functions)

You can use some of these render functions:

renderDataTable({ })

renderGauge({ })

renderImage({ }) 

renderPlot({ })

renderPlotly({ })

renderPrint({ })

renderSankeyNetwork({ })

renderTable({ })

renderText({ })

renderUI({ }) 

renderValueBox({ })

- DYNAMIC DASHBOARD

Note: All of this examples has been obtained using the data file LogFile_corrected.csv

Thanks!!!