pipe_discard_steps | R Documentation |
Discard all steps that match a given pattern
.
pipe_discard_steps(pip, pattern, recursive = FALSE, fixed = TRUE, ...)
pip |
|
pattern |
|
recursive |
|
fixed |
|
... |
further arguments passed to |
the Pipeline
object invisibly
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.