Skip to main content

Starter Dashboard

Where this fits

You named the three pathways on dash01 and applied the 1-1-1-1-1 rule on dash02. This page is the required core artifact for Week 8: the Quarto-rendered dashboard-style page you will adapt for Assignment 7. The Shiny exemplar discussed on dash05 is a demonstration only — your A7 deliverable is built from the file on this page, not from the Shiny app.

Goal

This starter shows how to turn the Week 7 descriptive summary into a dashboard-style KT product. It uses one editable control value, one visualization, one table, one interpretation, and one caution — the 1-1-1-1-1 rule made concrete.

Audience Question

Audience: a public-health analyst preparing a short briefing on descriptive BMI patterns in the classroom NHANES equity dataset.

Question: among adults age 20-80, how does mean BMI vary across NHANES cycles for one selected income group?

Setup

library(tidyverse)  # AI-EDIT(2026-06-23): tidyverse-default — consolidated core library() calls into library(tidyverse)
library(knitr)

candidate_paths <- c(
  "examples/nhanes-equity/data/nhanes_equity_v6.csv",
  "../../examples/nhanes-equity/data/nhanes_equity_v6.csv"
)

data_path <- candidate_paths[file.exists(candidate_paths)][1]
if (is.na(data_path)) {
  stop("Could not find examples/nhanes-equity/data/nhanes_equity_v6.csv")
}

nhanes <- read_csv(data_path, show_col_types = FALSE)

Control

In a Shiny app, this would become a dropdown. In this static starter, change the value of selected_income and render again.

available_income_groups <- sort(unique(na.omit(nhanes$IncomeGroup)))
selected_income <- "Low Income (<1.3)"

if (!selected_income %in% available_income_groups) {
  selected_income <- available_income_groups[1]
}

selected_income
#> [1] "Low Income (<1.3)"

For example, change the line to selected_income <- "Middle Income" — the other valid value in the classroom dataset is "High Income (>3.5)". Copy the value exactly, including the quotes and any parentheses.

Summary

dashboard_summary <- nhanes |>
  filter(
    Age >= 20,
    Age <= 80,
    IncomeGroup == selected_income,
    !is.na(BMI),
    !is.na(Cycle)
  ) |>
  group_by(Cycle) |>
  summarise(
    n = n(),
    mean_bmi = round(mean(BMI), 1),
    .groups = "drop"
  )

kable(dashboard_summary)
Cycle n mean_bmi
1999-2000 1091 28.8
2001-2002 1089 28.7
2003-2004 1183 28.6
2005-2006 1091 29.3
2007-2008 1552 29.1
2009-2010 1817 29.5
2011-2012 1724 29.4
2013-2014 1762 29.5
2015-2016 1568 30.0
2017-2018 1275 30.1
2021-2023 1141 30.4

Visualization

ggplot(dashboard_summary, aes(x = Cycle, y = mean_bmi, group = 1)) +
  geom_line(linewidth = 0.8, color = "#2f6f73") +
  geom_point(size = 2.4, color = "#2f6f73") +
  labs(
    title = paste("Mean BMI for", selected_income),
    subtitle = "Adults age 20-80 in the prepared NHANES Health Equity classroom dataset",
    x = "NHANES cycle",
    y = "Mean BMI",
    caption = "Descriptive, unweighted classroom summary. Missing BMI, income group, cycle, and out-of-cohort ages are excluded."
  ) +
  theme_minimal(base_size = 12) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

Interpretation

For the selected income group, the table and figure describe the mean BMI pattern across available NHANES cycles in the prepared classroom dataset. The dashboard should help the audience ask better questions about pattern, timing, and context rather than treat the line as a causal explanation.

Limitation

This starter is unweighted and descriptive. It does not account for NHANES survey design, does not estimate national prevalence, and should not be used to make causal claims about income and BMI.

Testing

Before submitting a dashboard-style product:

  1. Render this page from the repository root.
  2. Change selected_income to another value from available_income_groups.
  3. Render again and check that the table, title, and plot all update.
  4. Verify that the caption still names the dataset, exclusions, and limitation.
  5. Record any warning or error in your testing log.
TipHow to render: the course default
  1. Open the .qmd file you want to render, then open the Command Palette (View → Command Palette, or press Ctrl+Shift+P on Windows/Linux / Cmd+Shift+P on Mac) and run Quarto: Render Document. The Quarto extension renders the file and opens a preview pane.

  2. Always-works fallback (terminal): type the render command with the file’s path as shown in the Explorer, for example:

    quarto render practice_report.qmd

    Always name the file — a bare quarto render rebuilds the whole project and takes much longer.

  3. If you see a Render (or Preview) button in the editor toolbar, it does the same thing as step 1.

Where did the output go? Watch the render log for the Output created: line — it names the exact .html file created. By default the file appears next to your .qmd; in projects that set an output directory (like this book’s docs/ folder), it appears there instead. If no preview opened automatically, find that .html file in the Explorer, right-click it, and choose Download to open it in your browser (or Open Preview if available).

HTML is the expected output for this dashboard — you do not need a PDF. If the render log warns about a missing TeX installation or a PDF problem, you can ignore it as long as the .html file was created. dash05 walks through the full six-step test routine for this same page.

Privacy-Safe Publishing

  • Use aggregate summaries, not row-level records.
  • Avoid small-cell interpretations when n is low.
  • State that outputs are descriptive and unweighted.
  • Keep cached classroom data separate from any raw NHANES retrieval workflow.
  • Do not upload row-level data to external AI tools.

Where this goes next

dash04 shows what counts as an audience-facing text change (allowed) versus an analytic change (not allowed for A7). dash05 walks through how to test this page in Codespaces and shows the optional Shiny exemplar that your instructor will demo in class.