---
title: "Codefrag demo"
subtitle: "Code annotations as fragments"
code-annotations: select
revealjs-plugins:
  - codefrag
---

## Step through an R pipeline

```{.r code-line-numbers="|1|2-3|4-5|6"}
library(dplyr)                          # <1>
mtcars |>
  filter(cyl == 6) |>                   # <2>
  group_by(gear) |>
  summarise(mean_mpg = mean(mpg)) |>    # <3>
  arrange(desc(mean_mpg))               # <4>
```

1. Load the `dplyr` package.
2. Keep only six-cylinder cars.
3. Compute the mean mileage per gear.
4. Sort the resulting table.
