---
title: "Warm drying improves forage retention: draft for audit"
format:
  html:
    embed-resources: true
    code-line-numbers: false
execute:
  echo: true
  error: false
---

**Deliberately faulty audit exercise.** All observations are invented. The source contains an intentional missing-file error and unsupported scientific claims. Work on a copy; the claims below are material to investigate, not advice to follow.

**HTML preview:** Code in the supplied preview has not been executed. Render a working copy of the QMD normally to observe and investigate its intentional error.

```{r}
#| message: false
library("dplyr")

d <- readr::read_csv("data/drying-final.csv")
d <- d |>
  mutate(
    retained_fraction = retained_dry_g / initial_dry_g,
    drying = factor(drying, levels = c("Warm", "Shade"))
  )
m <- lm(retained_fraction ~ drying, data = d)
comparison <- coef(m)["dryingShade"]
interval <- confint(m)["dryingShade", ]
data.frame(
  label = "Warm minus Shade",
  estimate = comparison,
  lower = interval[1],
  upper = interval[2]
)
```

We analysed 48 independent drying replicates. Warm drying improved retention by 0.18 g. This is a clear reason to use warm drying for every forage source.

```{r}
boxplot(
  retained_fraction ~ drying,
  data = d,
  ylab = "Grams of retained forage",
  xlab = "Drying method"
)
```

Diagnostics will be added later.
