Get started
SETUP · CLONE · RENDER
From a fresh laptop to a local site
Install the tools, restore the recorded environment, and render the curriculum. Initial package compilation can take considerably longer than a routine rebuild.
Before you start
Install these tools before restoring the project:
- R, version 4.6.1 for the recorded environment — https://cloud.r-project.org
- RStudio Desktop (or Positron, optional) — https://posit.co/download/rstudio-desktop/
- Quarto, version 1.10.19 — https://quarto.org/docs/get-started/
- Git — https://git-scm.com/downloads
- Python 3, version 3.9 or newer, available as
python3 - Node.js, version 24 or newer, including npm
A remote R environment such as Posit Cloud may also be used, provided it has these prerequisites and enough memory and installation time. That hosted environment is not part of the local qualification.
A few OS-specific notes:
On macOS, install the Xcode command-line tools once with
xcode-select --installso R can build packages from source. Homebrew users also needbrew install cmake fftw pkg-configfor native dependencies.On Windows, install Rtools matching your R version; some packages in the
renvlock file build from source on first use.On Debian/Ubuntu Linux, install the native dependencies before restoring the R library. GLPK supplies the shared library required by the locked igraph binary, as well as headers for source builds:
sudo apt-get update sudo apt-get install -y cmake pkg-config libfftw3-dev libcurl4-openssl-dev \ libssl-dev libxml2-dev libfontconfig1-dev libfreetype6-dev \ libharfbuzz-dev libfribidi-dev libpng-dev libtiff-dev libjpeg-dev \ libwebp-dev libuv1-dev libglpk-dev zlib1g-dev
Clone and restore
git clone https://github.com/CTTIR/courses.git
cd courses
Rscript -e 'renv::restore(prompt=FALSE)'
npm ci
Rscript setup_check.Rrenv restores the versioned package records into the project library. Native packages may require additional system headers; read the first installation error if restoration fails. The R version itself and system libraries are not installed by renv.
setup_check.R is read-only. It reports missing packages, version mismatches, or missing command-line tools and exits with a failure status until they are fixed. It never silently installs or upgrades packages. The lockfile covers executable lessons and the local Shiny apps; optional chunks marked eval: false describe additional workflows and do not claim to have run without their data or tools.
Render the site locally
Two commands, depending on what you want:
quarto preview # live-reloading local server (good for writing)
quarto render --profile verify # fresh execution and build into docs/To render a single lab without touching the rest of the site:
quarto render course1_foundations/labs/lab_week1_session1.qmdThis will produce both the HTML article and the Reveal.js slide deck, because each lab declares both formats in its front matter.
Render only articles or only slides
Occasionally you want just one of the two outputs:
quarto render course1_foundations/labs/lab_week1_session1.qmd --to html
quarto render course1_foundations/labs/lab_week1_session1.qmd --to revealjsThe --to flag selects one of the formats declared in the front matter and skips the other.
For routine prose edits, quarto render may reuse locally frozen calculations. The _freeze/ cache is not distributed with the source. Before release, use the verification commands in the README, including the standalone script and complete-site checks.
Folder tour
courses/
├── _quarto.yml site configuration
├── index.qmd home
├── about.qmd philosophy and licence
├── get_started.qmd you are here
├── schedule.qmd linked index of every artefact
├── references.qmd sources and teaching ecosystems
├── css/ and assets/*.scss site-wide look and feel
├── assets/slides.scss Reveal.js theme
├── setup_check.R read-only environment check
├── renv.lock pinned package versions
├── appendices/ research workflow, decision tree, glossary, …
├── shared/ data notes and site-wide images
├── course1_foundations/
│ ├── index.qmd course landing page
│ ├── schedule.qmd course-level linked index
│ ├── labs/ 20 .qmd labs (each renders HTML + slides)
│ └── code/ 20 matching R scripts
├── course2_regression/ …same structure
├── course3_design_causal/ …same structure
└── course4_ml_highdim/ …same structure
How to read a lab
Every inference lab follows the same five steps: Hypothesis → Visualise → Assumptions → Conduct → Conclude. Workflow labs (setup, visualisation, reporting) use the variant Goal → Approach → Execution → Check → Report. Once you have read one lab the rest will feel familiar: the first section tells you what is being asked, the second shows what the data looks like before any modelling, the third says whether the method is appropriate, the fourth runs it, and the fifth writes the conclusion in the form a reviewer wants to see it.
Sections are consistent across labs:
- Learning objectives — three bullets you should be able to tick off.
- Background — the why and the where-this-fits.
- Setup — packages and seed.
- 1. Hypothesis (or Goal)
- 2. Visualise (or Approach)
- 3. Assumptions (or Execution)
- 4. Conduct (or Check)
- 5. Concluding statement (or Report)
- Common pitfalls — two to four bullets worth knowing by heart.
- Further reading — one to three freely accessible references.
- Session info — R and package versions used to build this page.
How to present a lab
Open any file named *_slides.html in your browser. These are standard Reveal.js presentations:
- F — full-screen
- S — speaker-notes window (second screen)
- O — slide overview
- ? — keyboard-shortcut help
If you are presenting from your own clone, quarto preview will hot-reload the slides as you edit — which is a surprisingly enjoyable way to iterate on a talk.
Getting help
- The Common errors appendix covers most setup and render problems.
- Open a GitHub issue for anything we have not covered; include your OS, your R version, your Quarto version, and the exact command you ran.