Skip to main content

Instructor notes

Author

Jean Golding Institute

At a glance

How it runs: slides, then (in sections 2 and 3) a short watch-only demo (the “wow”), then one activity: Together (we do a part), Your turn (they do it on their own), Answer (you show it). In the live session, attendees never run code: the only thing they run is Render. The R and Python examples are for them to read, and the capstone is where they write their own. The steps for each demo and activity are in the speaker notes of its slide (press S in the deck).

# Section Min Objective Demo (you) Activity
1 Project structures 25 1 none Rescue the messy project
2 Documentation & Quarto 45 2, 3, 5 Change the data, the report updates Be the new colleague. One document, many formats
3 Virtual environments 30 4, 5 Set up an environment, delete it, rebuild it The new laptop test
4 Your first step 15 6 none Your checklist
(+) Optional: Q-FAIR +5 6 none Q-FAIR detective

By the end, attendees can:

  1. Organise a project into raw data, processed data, code and outputs, and explain why raw data is never edited.
  2. Describe what a good README and data dictionary contain, and why they matter, particularly for Data Management Plans.
  3. Explain why Quarto helps reproducibility, and make HTML, PDF and Word versions of a report from one document.
  4. Explain why environments matter, and say what someone needs in order to re-run your project on another computer.
  5. Apply these practices to your own coding projects, using the R and Python examples as a starting point.
  6. Choose one practice to start using on your own project, and know where to find out more.

Before you start

  • Download and unzip the example folder. Copy tidy-project/ somewhere you can change it.
  • You need R and Quarto 1.4+ on your own machine for the section 2 demo. Run code/run_all.R once to check it works.
  • Press Render on one-document/report.qmd: attendees will do this. Attendees need Quarto only, not R or Python.
  • For the environment demo, choose R or Python. Run through the steps in environment-demo/r/README.md (needs the renv package) or environment-demo/python/README.md (needs uv) once, in a copy of the folder: the first run downloads the packages.
  • Check the links on the slides and notes.

Ground rules

  • Nobody runs code except Render. Never debug live. If a demo fails, say so, show the finished version, and move on.
  • Demos are watch-only. The activities are on paper or in a document.
  • The course is online: no pair work. Every Your turn is done on your own, and people share answers by typing in the chat. Read a few out.
  • Wording works for everyone in the university. Spreadsheet users do the same activities.
  • If running late, skip the optional slides first, then shorten a Your turn, not a section.

1. Project structures (25 min)

Demo: none. Activity: Rescue the messy project: look at messy-project/ together, then on their own they sort every file into raw data, cleaned data, code, results or documents, and you show tidy-project/ as the answer.

Checkpoints: by 5 min Together; by 9 Your turn; by 15 Answer; finish at 25.

Key messages

  • Raw data is never edited. Everything after it can be re-made, so protect the raw data and the code.
  • Raw / processed / code / outputs, in a pipeline.
  • Messy projects happen naturally. Nobody is being criticised.
  • Spreadsheets: same rule. Keep the original, work on a copy.

Don’t forget

  • In Together, let people feel the problem before you explain it.
  • At the Answer, ask who disagreed, and why. There is more than one reasonable layout.

If running late: shorten Together. Watch out for: “it is quicker to fix the typo in the raw file”.

2. Documentation & Quarto (45 min)

Demo: Change the data: in a copy of tidy-project/, uncomment the 2008 line in code/01_clean_data.R, run code/run_all.R, and every number in the report changes. Activities: Be the new colleague (from messy-project/notes.txt, write down three things they can’t work out; the answer is the README and data dictionary) and One document, many formats (render one-document/report.qmd to HTML, PDF and Word).

Checkpoints: by 3 min Be the new colleague (Together); by 13 Quarto slides; by 21 demo; by 25 One document, Together; by 31 Your turn; by 38 Answer; finish at 45.

Key messages

  • Four kinds of documentation. Write for the person who will read it.
  • A README answers: what is it, how do I run it, what do I need. A README that is wrong is worse than none.
  • A data dictionary: copying the column names is easy. The descriptions are the value.
  • Quarto: the report is the analysis. No copy and paste. Data changes, so render again.
  • One document can make many formats, and this deck, the notes and the website are all Quarto.

Don’t forget

  • Read the messy notes.txt out loud with a straight face.
  • Open the Quarto part with “who has copied a number into Word and then found the data had changed?”
  • At the demo: change the data, and let them watch every number change.
  • In One document, make sure each person renders all three formats (the format menu, or quarto render report.qmd).
  • Show the “Learn more about Quarto” slide at the end.

If running late: skip the “old way vs the Quarto way” slide. Watch out for: Render failing (Quarto not set up) or only making one format. Send them to one-document/finished/. Inline code needs Quarto 1.4 or later.

3. Virtual environments (30 min)

Demo: Delete it, then rebuild it: in a copy of environment-demo/r/ or environment-demo/python/, set up an environment (renv::init(), or uv init --no-package and uv add pandas matplotlib), delete it (renv/library or .venv), and rebuild it from the lock file (renv::restore() or uv sync). The steps are in each folder’s README. Activity: The new laptop test: a colleague’s project fails on a new laptop, and they list everything they would need to know to run it; the answer is the README and a lock file.

Checkpoints: by 10 min the demo; by 15 Together; by 17 Your turn; by 23 Answer; finish at 30.

Key messages

  • “It worked last year”: packages change, and one computer has one shared set.
  • An environment is a project’s own packages. The lock file is the recipe, and the environment is disposable.
  • Send your project to someone: the code, README and lock file, not the environment. They rebuild it with one command.
  • What it doesn’t cover: the R or Python version, the operating system, the data.
  • Spreadsheets: write the program and its version in the README.

Don’t forget

  • Spend the time on the why. The demo is only for the wow.
  • At the demo, say “this is what your colleague does when you send them the project”.
  • renv records package versions, not the version of R. Say so.
  • In Your turn, give no hints. Let them find the list.

If running late: drop the “tools” slide. Watch out for: the demo going wrong (uv or renv not set up). If it does, show the lock file in environment-demo/r/finished/ or environment-demo/python/finished/ and describe it.

4. Your first step (15 min)

Demo: none. Activity: Your checklist: they tick the checklist for a project of their own (or the messy one), circle one thing to start with, and post it in the chat. Optional extra: Q-FAIR detective.

Checkpoints: by 3 min the checklist; by 9 Quick wins; by 12 the recap; finish at 15.

Key messages

  • The whole course is one journey: messy, tidy, documented, reported, recorded, shareable.
  • Each habit is small. Pick one and do it this week.
  • Start with a quick win: a README takes 15 minutes.

Don’t forget

  • Ask people to circle one thing, and post it in the chat.
  • Point out the printable checklist in the example folder (checklist.pdf and checklist.docx).
  • Go back to the six objectives and tick them off.
  • Mention the separate git and GitHub course.
  • Point people to the capstone exercise (Putting it all together, linked from the home page), to try after the course: a tidy project, an environment (R or Python) and a report with code, from scratch.

If time: the optional slides after Thank you cover Q-FAIR (the principles, why it matters, four things to do) and a Q-FAIR detective activity. Watch out for: nothing, except people leaving with a long to-do list. One thing is enough.