Skip to main content

gentletargz

A gentle introduction to {targets}, in three hours

Author

Nicholas Tierney

Published

November 30, 2026

Welcome

Thanks for reading this book!

This is a three-hour workshop on {targets}.

The goal of gentletargz is as follows:

  1. Convince you {targets} is worth learning, and that you can use it
  2. For you to be able to start using {targets} after 45 minutes
  3. For you to feel more confident writing functions

Why gentletargz

This course is a compressed version of another course I have delivered, “Introduction to targets and geotargets”.

The joke is that this is a compressed version of a talk on a gentle introduction to targets. tar.gz is a program for doing file compression, hence, targz.

Abstract

Data analysis is an iterative process. Data cleaning, exploratory data analysis (EDA), and model fitting are rarely run without a hitch from start to finish. Each step takes time, and often requires revisiting earlier steps to correct for newly discovered problems. For example, in performing EDA, you can unearth a text issue that requires revisiting data cleaning. When you are finally done with the analysis, you will need to reproduce it to check it all works as expected.

To reproduce the analysis, there is a temptation to run the code again from the top, which may take a long time. You can save time by saving model outputs, but if you make a change to an earlier data cleaning step, you’ll need to update everything that depends on that. You can write code to manage these dependencies, but this is a hard problem. Fortunately, “pipeline tools” are an existing approach to manage these dependencies. They take care of the details of watching which files and relevant code changes, and only run the necessary parts. The {targets} R package is one popular pipeline approach, providing extensive documentation and user support. However, it presents a different coding practice that might not be familiar.

In this interactive workshop, I will gently introduce the ideas behind {targets}, and will live code a data analysis using {targets} from scratch, warts and all. I encourage questions throughout the live coding workshop, so you can understand the process and see how this could benefit your own work.

Plan

The course has two sections, as follows:

Script to pipeline (90 minutes).

  • Start with a script someone (me) sent you
  • Turn it into functions
  • Turn the functions into a pipeline

Working in a pipeline (90 minutes)

  • Change code and understand how targets saves/caches content
  • Enjoy this magic
  • Write a report that updates when data updates
  • Break the pipeline on purpose, to learn how to get unstuck

Extensions

The end of the course will also have an opportunity to discuss some additional content, if there is time:

  • branching
  • spatial data with {geotargets}
  • or your own analysis

The data

We will be exploring some public data from the City of Melbourne - pedestrian counts.

We will be exploring a simple question: When, and where is the city most busy?

Links