Learn R Programming

targets (version 0.0.0.9000)

tar_outdated: Check which targets are outdated.

Description

Checks for outdated targets in the pipeline, targets that will be rerun automatically if you call tar_make() or similar. See tar_cue() for the rules that decide whether a target needs to rerun.

Usage

tar_outdated(
  names = NULL,
  branches = FALSE,
  targets_only = TRUE,
  reporter = "silent",
  callr_function = callr::r,
  callr_arguments = list(spinner = reporter == "silent")
)

Arguments

names

Names of the targets. tar_outdated() will check these targets and all upstream ancestors in the dependency graph. Set names to NULL to check/build all the targets (default). Otherwise, you can supply symbols, a character vector, or tidyselect helpers like starts_with().

branches

Logical, whether to include branch names. Including branches could get cumbersome for large pipelines. Individual branch names are still omitted when branch-specific information is not reliable: for example, when a pattern branches over an outdated target.

targets_only

Logical, whether to just restrict to targets or to include functions and other global objects from the environment created by running _targets.R.

reporter

Character of length 1, name of the reporter to user. Controls how messages are printed as targets are checked. Choices:

  • "silent": print nothing.

  • "forecast": print running totals of the checked and outdated targets found so far.

callr_function

A function from callr to start a fresh clean R process to do the work. Set to NULL to run in the current session instead of an external process (but restart your R session just before you do in order to clear debris out of the global environment). callr_function needs to be NULL for interactive debugging, e.g. tar_option_set(debug = "your_target"). However, callr_function should not be NULL for serious reproducible work.

callr_arguments

A list of arguments to callr_function.

Value

Names of the outdated targets.

Details

Requires that you define a pipeline with a _targets.R script in your working directory. (See tar_script() for details.)

Examples

Run this code
# NOT RUN {
tar_dir({
tar_script(tar_pipeline(tar_target(x, 1 + 1)))
tar_outdated()
tar_script(
  tar_pipeline(
    tar_target(y1, 1 + 1),
    tar_target(y2, 1 + 1),
    tar_target(z, y1 + y2)
  )
)
tar_outdated()
})
# }

Run the code above in your browser using DataLab