drake (version 6.2.1)

ignore: Ignore components of commands and imported functions.

Description

In a command in the workflow plan or the body of an imported function, you can ignore(some_code) to

  1. Force drake to not track dependencies in some_code, and

  2. Ignore any changes in some_code when it comes to deciding which target are out of date.

Usage

ignore(x = NULL)

Arguments

x

code to ignore

Value

The argument.

See Also

file_in(), file_out(), knitr_in()

Examples

Run this code
# NOT RUN {
test_with_dir("Contain side effects", {
# Normally, `drake` reacts to changes in dependencies.
x <- 4
make(plan = drake_plan(y = sqrt(x)))
x <- 5
make(plan = drake_plan(y = sqrt(x)))
make(plan = drake_plan(y = sqrt(4) + x))
# But not with ignore().
make(plan = drake_plan(y = sqrt(4) + ignore(x))) # Builds y.
x <- 6
make(plan = drake_plan(y = sqrt(4) + ignore(x))) # Skips y.
make(plan = drake_plan(y = sqrt(4) + ignore(x + 1))) # Skips y.
# What about imported functions?
f <- function(x) sqrt(4) + ignore(x + 1)
make(plan = drake_plan(x = f(2)))
readd(x)
f <- function(x) sqrt(4) + ignore(x + 2)
make(plan = drake_plan(x = f(2)))
readd(x)
f <- function(x) sqrt(5) + ignore(x + 2)
make(plan = drake_plan(x = f(2)))
readd(x)
})
# }

Run the code above in your browser using DataLab