Instructor Notes
Teach the Eight-Lesson Sequence
Applied R progresses from saved calculations and checked inputs through defensive programming, repeatable analysis, notebooks and dashboards. The first five established URLs remain available; the old variables page now teaches lesson 2.
| Lesson | Evidence to ask for |
|---|---|
| 1. R and RStudio Foundations | A saved and checked starting workflow |
| 2. Importing and Understanding Research Data | An inspectable input and selection |
| 3. Functions, Testing and Defensive Programming | Reusable and tested calculations |
| 4. Iteration and Repeatable Workflows | A repeatable operation with recorded outcomes |
| 5. Cleaning, Wrangling and Joining Data | A checked table and reusable analysis |
| 6. Exploratory Analysis and Visualisation | Figures with qualified interpretations |
| 7. Digital Research Notebooks | A reproducible computational research record |
| 8. Interactive Research Dashboards | A checked local interactive app |
All eight lessons use 60 minutes teaching, six five-minute activities including room responses/debriefs and a separate ten-minute break: 100 minutes overall. Deliver two lessons per half-day workshop if useful. Lessons 5–8 carry the same project through analysis, figures, a computational notebook and a reactive app. The larger inherited banks in lessons 5/6 remain optional, outside that core plan.
Preparation and Access
Complete Learner Setup in the environment you will demonstrate. Check RStudio, the project, the downloaded CSV and packages used by the planned examples. The course uses historical Gapminder data, alongside explicitly fictional small tables and temperature examples. Do not describe the current R sequence as an inflammation study or a command-line programming workshop.
The established episode configuration supports local R examples and WebR. Retain that delivery arrangement and test any browser example you plan to use. Prepare saved tables, figures and code for shared-screen or paper annotation if access fails; package installation should not consume the practical work of a session.
Inspect the output folder before repeating export demonstrations. Outputs are derived practice files and may be replaced by a rerun; keep source files unchanged. Demonstrate a fresh-session run only after saving scripts and learner work.
Teaching Approach
- Build a small program visibly, making each decision and check explicit. Keep intermediate attempts where they help learners understand the change.
- Ask for a prediction before execution, then take a reasoned answer from a pair after checking it.
- Use one operator and one checker in each pair and swap roles. Ask the checker to identify input, output, units and the source comparison.
- Introduce only the language features needed for the task. The goal is a usable mental model rather than exhaustive syntax coverage.
- Distinguish commands saved in a script, objects in memory and files on disk. Ask learners what remains after restarting R.
- Use the learner Additional Material workflow for follow-up practice, and select Extra Exercises after the relevant session.
Checks That Matter in This Course
- Foundations and research data: R indexes from one. Data-frame rows may combine text and measurements; averaging or coercing the whole row is not an appropriate default.
- Functions: retain the existing Fahrenheit conversion formulas and distinguish kelvin from degrees Celsius. Two decimal places are a presentation choice; do not round intermediate results silently.
- Iteration: compare one exported country–year record and record row counts. CSV does not retain all R metadata, such as factor levels.
- Wrangling: the packaged Gapminder data end in 2007. Exercise 6 deliberately retains a request for 2012 and
pop <= 3; discuss unavailable years and population units rather than changing the conditions silently. - Interpretation: unweighted country means are not population-weighted global means. Repeated country–year plots and smooths do not establish individual or causal claims.
- Joins and missing values: inspect repeated keys and unmatched IDs. The missing-value replacements in the fictional syntax example are arbitrary and require a justified policy before real use.
- Plot scales: the retained axis-limit example can remove observations before smoothing. Inspect warnings and compare the purpose of scale limits with visual zooming.
Prepare the Notebook and Dashboard
Download/extract the shared project before delivery. Check Rscript tests.R, a fresh quarto render report.qmd, a second recorded year and shiny::runApp("."). Verify that table, plot, coverage and download agree; clear the countries to check the empty state. Do not start an app server while running tests.R in the same session.
Prepare a rendered notebook and app screenshots for the access fallback. Show the complete app before asking learners to change an identifier; maintain an untouched practice copy so the deliberately broken connection can be restored. Ask pairs to trace input → shared selection → output and identify one check rather than merely copying UI code.
Do not attempt hosting, authentication or production operations inside the 100-minute introduction. Explain the runtime and ownership needed for a conventional Shiny service, and keep the classroom example public. Learners leave with a checked local app and a handover, not an automatically deployed service.
Optional Git Demonstration
Git is an extension rather than a prerequisite for these eight lessons. Use a practice repository and follow the current RStudio version-control guide. Check that RStudio can find the installed Git executable before the event. Explain a local change and review before introducing remotes or shared repositories; do not ask learners to alter a live research repository simply to follow the demonstration.