Instructor Notes
General notes
The examples gradually build up to a full analysis of the Palmer Penguins
dataset, which is included in base R as penguins and
penguins_raw; the final version is in this repository: the
workflow (_targets.R) is plan_11.R
(the last of the numbered plan files in
episodes/files/plans/), the custom functions it uses are in
tar_functions,
and the report is penguin_report.qmd.
R version
The penguins datasets were added to base R in R version 4.5.0, so this lesson requires R 4.5.0 or later. Check that learners (and any shared server or cloud instance you plan to use) have a recent enough version of R before the workshop.
This lesson does not provide a hosted environment. If you want to run the workshop on a cloud service such as Posit Cloud, you will need to set one up yourself with R 4.5.0 or later and the packages listed in the setup instructions.
Optional episodes:
The “Managing Packages” episode covers a more advanced topic
(different ways to load packages, tracking package versions with
renv, and namespace conflicts) and could be skipped if you
are short on time. The rest of the lesson does not depend on it: the
workflow already loads its packages with library().
The “A Brief Introduction to Functions” episode is an optional episode and will depend on the learners coming to your workshop. We would recommend having a show of hands (or stickies) who has experience with functions, and if you have learners who do not, run this episode.
targets relies so much on functions we believe it is worth spending a little time on if you have learners inexperienced with them, they will quickly fall behind and not be empowered to use targets at the end of the workshop if they don’t get a short introduction.
Introduction
Instructor Note
Episode summary: Introduce the idea of reproducibility and why / who
would want to use targets
First targets Workflow
Instructor Note
Episode summary: First chance to get hands dirty by writing a very simple workflow
A Brief Introduction to Functions
Instructor Note
Episode summary: A very brief introduction to functions, when you have learners who have no experience with them.
Loading Workflow Objects
Instructor Note
Episode summary: Show how to get at the objects that we built
Instructor Note
- To reinforce the concept of
targetsrunning in a separate R session, you may want to pretend trying to runpenguins_data, then feigning surprise when it doesn’t work and using it as a teaching moment (errors are pedagogy!).
The Workflow Lifecycle
Instructor Note
Episode summary: Demonstrate typical cycle of running
targets: make, inspect, adjust, make…
Best Practices for targets Project Organization
Instructor Note
Episode summary: Demonstrate best-practices for project organization
Managing Packages
Instructor Note
Episode summary: Show how to load packages and maintain package versions
Branching
Instructor Note
Episode summary: Show how to use branching
Parallel Processing
Instructor Note
Episode summary: Show how to use parallel processing
Working with External Files
Instructor Note
Episode summary: Show how to read and write external files
Reproducible Reports with Quarto
Instructor Note
Episode summary: Show how to write reports with Quarto