pipe_discard_steps {pipeflow} | R Documentation |
Discard steps from the pipeline
Description
Discard all steps that match a given pattern
.
Usage
pipe_discard_steps(pip, pattern, recursive = FALSE, fixed = TRUE, ...)
Arguments
pip |
|
pattern |
|
recursive |
|
fixed |
|
... |
further arguments passed to |
Value
the Pipeline
object invisibly
Examples
p <- pipe_new("pipe", data = 1:2)
pipe_add(p, "add1", \(x = ~data) x + 1)
pipe_add(p, "add2", \(x = ~add1) x + 2)
pipe_add(p, "mult3", \(x = ~add1) x * 3)
pipe_add(p, "mult4", \(x = ~add2) x * 4)
p
pipe_discard_steps(p, "mult")
p
# Re-add steps
pipe_add(p, "mult3", \(x = ~add1) x * 3)
pipe_add(p, "mult4", \(x = ~add2) x * 4)
p
# Discarding 'add1' does not work ...
try(pipe_discard_steps(p, "add1"))
# ... unless we enforce to remove its downstream dependencies as well
pipe_discard_steps(p, "add1", recursive = TRUE)
p
# Trying to discard non-existent steps is just ignored
pipe_discard_steps(p, "non-existent")
[Package pipeflow version 0.2.2 Index]