Appendix B — Community comparison: get ready

Published

Oct 2026

Question: How do community composition and diversity vary between two groups?

Inputs: 24 synthetic samples, 12 per group, and 15 fictional features.

Finish with: composition, diversity, and count-total figures; checked tables; a short report.

This is a descriptive teaching example. Visual differences alone do not establish statistical significance or causation. When adapting it, check that the methods suit your study design.

To explore without installing software, open See the result. To reproduce the analysis, complete the setup below once.

Prepare your environment

You need R, Quarto, and a text editor such as VS Code or RStudio.

Open the project root

Download and extract the repository, then open the folder containing _quarto.yml, renv.lock, data/, and scripts/ in your editor.

Open a terminal in that folder. Run every command in this example from this project root, including commands shown on pages stored inside examples/.

Restore the R environment

In the terminal, start R:

R

At the R prompt (>), run:

options(repos = c(CRAN = "https://cloud.r-project.org"))

if (!requireNamespace("renv", quietly = TRUE)) {
  install.packages("renv")
}

renv::restore()
renv::status()

If asked to proceed, enter Y and wait for the > prompt before entering another command. Restore the supplied lockfile rather than initializing a new environment.

Check that the analysis packages load, then return to the terminal:

library(tidyverse)
library(vegan)

q(save = "no")
Note

If setup fails: copy the error message. Ask AI to explain it using your R version, operating system, and the command you ran. Check the proposed fix before applying it. Keep the supplied lockfile intact while investigating.

Ready to begin?

  • Your terminal is open at the project root.
  • renv::status() reports no synchronization issues.
  • Both analysis packages load successfully.

Continue to 1. See the result.