Communicate

LAW Module 4: A Code Along

Welcome to the LAW Code Along for Module 4

  • The Communicate phase of the LAW is about selecting, polishing, and presenting findings to an audience.

Module Objectives

By the end of this module, learners will:

  • Develop an intuition for the Communication phase of the learning analytics workflow.
  • Understand the utility and power of dashboards for data communication.
  • Build a dashboard of their own, experimenting with its modular components (e.g., tabs, plots, sidebars, etc.).

Preparing Findings for Communication

Dashboards for Communication

  • Dashboards are one of the most flexible ways you can communicate findings with R!

  • Like other data products, they can be coded using R and R Markdown, and knitted using Quarto.

  • Navigation bar: Icon, title, and author along with links to sub-pages if needed

  • Pages, rows, & columns: Defined using markdown headings (with optional attributes to control height, width, etc.)

  • Tabsets: Used to further divide content within a row or column

  • Cards: Containers for plots, data display, and free form content, typically mapped to cells in your notebook or source document

  • Sidebars and toolbars: Present inputs within interactive dashboards

To make your markdown file a dashboard, use the YAML header to specify “flexdashboard”.

---
title: "ADD A TITLE"
output:
  flexdashboard::flex_dashboard:
    theme: 
      version: 4
      bootswatch: pulse
    source_code: embed
  html_document:
    df_print: paged
editor_options: 
  chunk_output_type: console
---

The Basic Dashboard

Layout: Rows

---
title: "Focal (Top)"
format: dashboard
---
    
## Row {height=70%}

```{r}
```

## Row {height=30%}

```{r}
```

```{r}
```

Layout: Columns

---
title: "Focal (Top)"
format: 
  dashboard:
    orientation: columns
---
    
## Column {width=60%}

```{r}
```

## Column {width=40%}

```{r}
```

```{python}
```

Tabsets

---
title: "Palmer Penguins"
format: dashboard
---
    
## Row

```{r}
```

## Row {.tabset}

```{r}
#| title: Chart 2
```

```{r}
#| title: Chart 3
```

Plots

```{r}
#| title: GDP and Life Expectancy
library(gapminder)
library(tidyverse)
ggplot(gapminder, aes(x = gdpPercap, y = lifeExp, color = continent)) +
  geom_point()
```

Tables

```{r}
library(gapminder)
library(tidyverse)
library(gt)
gapminder |>
  group_by(continent, year) |>
  summarize(mean_lifeExp = round(mean(lifeExp), 1)) |>
  pivot_wider(names_from = continent, values_from = mean_lifeExp) |>
  gt()
```

Other Features

  • Text content

  • Value boxes

  • Expanding cards

  • Interactive elements

    • For interactive exploration, some dashboards can benefit from a live R backend.

    • To do this with Quarto, add interactive Shiny components.

    • Deploy with or without a server!

👉 Your Turn ⤵

Create a data story with our current data set.

  • Develop a research question.
  • Add ggplot visualizations.
  • Model your visualizations.
  • Add a short write up for the intended stakeholders.

What’s Next?