Skip to contents

Simplify target specification in pipelines.





Named and unnamed targets. All named targets must follow the drake-plan-like target = command syntax, and all unnamed arguments must be explicit calls to create target objects, e.g. tar_target(), target archetypes like tar_render(), or similar.


A list of tar_target() objects. See the "Target objects" section for background.


Allows targets with just targets and commands to be written in the pipeline as target = command instead of tar_target(target, command). Also supports ordinary target objects if they are unnamed. tar_plan(x = 1, y = 2, tar_target(z, 3), tar_render(r, "r.Rmd")) is equivalent to list(tar_target(x, 1), tar_target(y, 2), tar_target(z, 3), tar_render(r, "r.Rmd")). # nolint

Target objects

Most tarchetypes functions are target factories, which means they return target objects or lists of target objects. Target objects represent skippable steps of the analysis pipeline as described at Please read the walkthrough at to understand the role of target objects in analysis pipelines.

For developers, explains target factories (functions like this one which generate targets) and the design specification at details the structure and composition of target objects.


if (identical(Sys.getenv("TAR_LONG_EXAMPLES"), "true")) {
targets::tar_dir({ # tar_dir() runs code from a temporary directory.
    tarchetypes::tar_fst_tbl(data, data.frame(x = seq_len(26))),
    means = colMeans(data) # No need for tar_target() for simple cases.