Day 3 · 09:30
A 47-tab workbook is not a briefing. Quarto (the successor to R Markdown) knits prose, code and charts into a PDF or HTML that rebuilds when the extract updates. That is the difference between a pack and a system.
You will leave able to
- Write a Quarto document with YAML, prose, and R chunks.
- Cache a heavy chunk and parameterise the month.
- Emit a one-pager a CFO would recognise as a trading update.
On the desk
The ancestor of this session used metal-band data to teach R Markdown. You will use a monthly commercial brief: campaign ROAS, a handful of sentences, and a table that cannot drift from the CSV. The skill is the same — literate programming — the audience is EXCO.
A document is a file with a header
---title: "Aurelia Foods — trading update"subtitle: "West Africa · Month 7"author: "Commercial excellence, Lagos Business School cohort"format: html: toc: true theme: [cosmo] pdf: documentclass: articleexecute: echo: false warning: falseparams: month: 7---Chunks
A chunk is a fenced block. Options in the header control whether it echoes, caches, or makes a figure of a given size. The prose around it is ordinary markdown: headings, bullet lists, links.
#| label: roas-table#| echo: false library(tidyverse)campaigns <- read_csv("campaign-roas.csv") %>% filter(week <= params$month) campaigns %>% group_by(channel) %>% summarise( spend = sum(spend_ngn_m), revenue = sum(revenue_ngn_m), roas = revenue / spend, .groups = "drop" ) %>% arrange(desc(roas))When params$month changes, the whole brief changes. That is the point. No more ‘I updated the chart but not the bullet’.
Prose that earns its place
Inline R lets a sentence stay true:
Search remains the conversion engine at`r round(search_roas, 1)`x ROAS. TV is not a failedchannel; it is a reach channel at `r round(tv_roas, 1)`x.We will not rank them on one number.Citations and numbers that do not type-drift
Quarto supports BibTeX. Use it for any external claim (Nielsen, NBS, CBN). For internal claims, the citation is the path: data/campaign-roas.csv, extract 12 August 2026. If you cannot point at a file, it is a rumour.
Exercise 3.1
Knit a one-pager
Create trading-update.qmd with the YAML above. Include: (1) a 3-sentence lead, (2) the ROAS table, (3) a bar chart of ROAS by channel, (4) a caption naming the CSV. Knit to HTML. Then change params.month and knit again. Confirm the table moved.
format: htmlfirst. PDF needs a LaTeX engine; do not fight that in the session.- Put
execute: echo: falseat the top so the pack looks like a pack.