Environmental Computing is a free online book of tutorials on R coding, data handling, graphics and statistics for environmental scientists. It began as teaching material for courses at UNSW Sydney, and is written by researchers, for researchers and students. More about the site is in the preface.
The book covers:
- Basics: installing R and RStudio, and organising projects
- Data literacy: importing, subsetting, combining, reshaping and summarising data
- Data visualisation: ggplot2, multi-panel figures, rasters and maps
- Statistical methods: t-tests, linear models, ANOVA, GLMs, mixed models, GAMs, meta-analysis and multivariate methods
- Coding skills: good practice, functions, loops, version control and asking code questions
The book is built with Quarto. Pages that moved from the old Hugo and WordPress sites still work, because their old addresses redirect to the matching chapters.
Open an issue. Every page also has “Edit this page” and “Report an issue” links.
Contributions are welcome, from typo fixes to whole tutorials. Read the contributing guide first. It covers file layout, naming, where images and data go, and caching.
To build the book locally, you need R and Quarto:
git clone https://github.com/nicercode/EnvironmentalComputing.git
cd EnvironmentalComputing
Rscript -e 'install.packages("remotes"); remotes::install_deps()' # packages from DESCRIPTION
quarto preview # live preview in your browserThings to know before opening a pull request:
- Commit
_freeze/. Chapters are only re-run when their source changes. After editing a chapter, render it (quarto render path/to/chapter.qmd) and commit the updated_freeze/entry along with it. - Add new packages to
DESCRIPTION, in alphabetical order, so CI can install them. - Keep old addresses working.
_redirectssends old site addresses to book chapters and sections. If you move or rename a chapter, or change a heading that a redirect points to, update the matching lines there; CI checks every redirect still lands somewhere. - Every pull request gets a deploy preview. It is linked in a comment on the PR, and CI checks that every chapter renders without errors and that internal links work.
The site is hosted on Netlify, on Daniel Falster’s (@dfalster) Netlify account. Ask him for access.
Netlify does not build the site itself, because its build image cannot
run the R code. Instead, GitHub Actions
(.github/workflows/book.yml) renders the
book and uploads _book/ to Netlify:
- every push to
masterdeploys to the live site, environmentalcomputing.net; - every pull request gets a deploy preview, linked in a comment on the PR;
- once a month, a scheduled run re-renders every chapter from scratch and checks external links. If a tutorial has broken (for example, after a package update), it opens an issue;
netlify.tomltells Netlify to skip its own builds (ignore = "exit 0").
The upload needs two repository secrets (Settings → Secrets and variables → Actions):
NETLIFY_AUTH_TOKEN: a personal access token from dfalster’s Netlify account (User settings → Applications → Personal access tokens);NETLIFY_SITE_ID: the Site ID of theenvironmentalcomputingsite (Site configuration → Site details). Do not use the other site,friendly-albattani-0a0cb6.
If either secret is missing, CI on master fails at the “Check Netlify
credentials” step; if the token has expired or been revoked, it fails at
“Deploy to Netlify”. Either way the live site stops updating until the
secret is replaced: create a new token and run
gh secret set NETLIFY_AUTH_TOKEN.
Old site addresses are redirected to book chapters by _redirects,
which is copied into _book/ at render time. It was first generated
when the site moved from Hugo to Quarto in 2026;
migration/ records how that port was done.
Environmental Computing is maintained by Daniel Falster, Will Cornwell and Alistair Poore at UNSW Sydney, and Fonti Kar at Monash University (Monash Business School). Tutorial authors are credited on each page.
The content is licensed under CC BY 4.0: you are free to reuse and adapt it, including for teaching, as long as you credit the source.
Thanks to everyone who has contributed new content and fixes on GitHub:
- Brendan Schuetze (@Brendan-Schuetze)
- John Wilshire (@johnWilshire)
- Mitchell Lyons (@mitchest)

