targets

The {targets} documentation and help manual should be the first places to look for details on {targets}. We’ll highlight some pages and links below relevant to the workshop, but be sure to spend time looking through these resources. This is a great example of an R package that has been very thoroughly and thoughtfully documented covering everything from beginner examples to the minutiae of how the package is designed and orchestrates workflows.

Help

This help page is a great place to start when you are looking for help using {targets}. It details things to do before posting, and when you have decided to post a question, where to post it. The {targets} developer prefers using GitHub Discussion Groups for troubleshooting and discussions instead of GitHub Issues.

GitHub Discussion Group

{targets} has a very active discussion group with plenty of past solutions and discussions to search through when you are looking for help.

Debugging

The debugging page is helpful for debugging {targets} workflows, especially when they get bigger and more complicated. Debugging in {targets} is different is a good place to start.

Documentation

Some select documentation pages from the {targets} documentation:

Bonus:

{targets} Overview Vignette

This vignette is an high-level summary of the features of {targets}.

User Manual

The {targets} R package user manual

This is the most complete guide to using {targets}. It has info on most of the questions that you will have (although can be complicated - be patient with yourself!). It explains what a target is, best practices for functions, and why error messages can be less intuitive in your {targets} workflow among many other things.

Courses

Short course of the {targets} R package

This is an official half-day interactive tutorial on {targets}. It is accompanied by:

  • Code repository: https://github.com/wlandau/targets-tutorial
  • Posit Cloud workspace to try it out without any required downloads or installation: https://posit.cloud/content/1699460
  • Introductory slides: https://wlandau.github.io/targets-tutorial/#1

Videos

Getting Started

This 4 minute video walkthrough gives a short example of how {targets} can be used. It is accompanied by:

  • User Manual: A walkthrough to get started
  • Code repository: https://github.com/wlandau/targets-four-minutes
  • Posit Cloud workspace to try it out without any required downloads or installation: https://posit.cloud/content/3946303

Extensions

Targetopia

{tarchetypes}

{tarchetypes} extends {targets} by providing functions to do complex tasks with shortcuts and simpler syntax, making your life easier. For example:

  • tar_group_by: define groups in a data.frame to split subsequent targets by
  • tar_render, tar_quarto: literate programming with {rmarkdown} or {quarto}
  • tar_file_read(): tracks a local file and reads the contents

Similar to {targets}, {tarchetypes} has a very active Discussion Group with plenty of discussions to search through for solutions, tips and tricks.

  • Documentation: https://docs.ropensci.org/tarchetypes/
  • Discussion Group: https://github.com/ropensci/tarchetypes/discussions

{stantargets}

{stantargets} is a package extending {targets} for Bayesian data analysis with Stan through {cmdstanr}.

  • Documentation: https://docs.ropensci.org/stantargets/
  • Discussion Group: https://github.com/ropensci/stantargets/discussions

{jagstargets}

{jagstargets} is a package extending {targets} for Bayesian data analysis with JAGS through {R2jags}.

  • Documentation: https://wlandau.github.io/jagstargets
  • Discussion Group: https://github.com/wlandau/jagstargets/discussions

{gittargets}

{gittargets} is a package extending {targets} for data version control.

  • Documentation: https://github.com/ropensci/gittargets
  • Discussion Group: https://github.com/ropensci/gittargets/discussions

Target factories

Target factories are an advanced approach to making pipeline construction easier. Instead of writing many tar_target() calls, a user can replace them with a call to a “target factory”. tar_file_read() from {tarchetypes} is a simple example of this - one call to tar_file_read() creates targets tracking the local file for changes and another to read the local file in with the provided command.

{tflow}

{tflow} is Miles McBain’s opinionated template for {targets} workflows.

  • Code repository: An opinionated lightweight template for smooth targets flows.