Skip to contents

A thin wrapper around targets::tar_network(): runs it, then converts its vertices/edges result with as_dag(), keeping type (which ggplot_dag() draws as the node shape, see targets_node_shapes()), status, description, seconds, bytes and branches.

Usage

tar_dag(targets_only = TRUE, envir = parent.frame(), ...)

Arguments

targets_only

Passed to targets::tar_network(); TRUE (unlike tar_network()'s own default of FALSE) because imported functions and objects clutter a metro plot.

envir

Environment to run the target script in. Forwarded explicitly (rather than left to tar_network()'s own default) so it resolves to the caller's environment, not a ggtargets function frame.

...

Passed to targets::tar_network(): names, shortcut, allow, exclude, outdated, reporter, callr_function, callr_arguments, script, store. names/allow/exclude accept tidyselect helpers exactly as in tar_visnetwork().

Value

A dag (see as_dag()).

Details

description is the one free-form field targets has for a target, and can hold the stage it belongs to, for dag_collapse() to collapse the pipeline by: see "Collapsing a pipeline by stage" in tar_ggplot().

Examples

targets::tar_dir({ # doesn't pollute the working directory
  targets::tar_script(list(
    targets::tar_target(x, 1),
    targets::tar_target(y, x + 1)
  ))
  ggplot_dag(tar_dag())
})