| pip_set_params | R Documentation |
pip_get_params() returns the current default values of all unbound
parameters of a pipeline or view (parameters wired to another step's
output via ~step_name are excluded), including those of locked steps.
pip_set_params() updates these parameters for the whole pipeline or
view. Steps whose values change are marked as outdated, together with
their downstream dependents (steps that have never run stay "new").
Values that are identical() to the stored ones are skipped and don't
outdate any step, unless force = TRUE.
pip_get_params(x)
pip_set_params(
x,
params = list(),
unknown = c("warn", "ignore", "error"),
force = FALSE
)
x |
A pipeflow pip or view. |
params |
Named list of parameters to set |
unknown |
How to handle |
force |
Logical. If |
For pip_get_params(), a named list of unbound parameter values;
if the same parameter name appears in multiple steps, the first
occurrence in pipeline order is returned. For pip_set_params(), the
updated pipeline or view, invisibly.
Parameters of locked steps are never changed and their state
remains unchanged. pip_get_params() still returns them, so if a locked
step comes first among the steps that share a parameter name,
pip_get_params() keeps returning the locked step's value after the
parameter was set.
An environment (or a reference object such as an R6 object) that was
modified in place is identical to the stored one, so setting it again
doesn't outdate the step unless force = TRUE.
p <- pip_new() |>
pip_add("load", \(n = 10) seq_len(n)) |>
pip_add("scale", \(x = ~load, factor = 0.5) x * factor)
# See all unbound/adjustable parameters before running
pip_get_params(p) # list(n = 10, factor = 0.5)
(pip_run(p))
# Updating params marks affected steps (and their dependents) outdated
pip_set_params(p, params = list(n = 5, factor = 2.0))
p
(pip_run(p))
# Setting the same values again doesn't outdate any step
pip_set_params(p, params = list(n = 5, factor = 2.0))
p
# Use force = TRUE to outdate the steps anyway
pip_set_params(p, params = list(n = 5, factor = 2.0), force = TRUE)
p
# Setting a parameter that is not defined in the pipeline yields a warning
pip_set_params(p, params = list(nope = 1))
# ... which can be silenced or turned into an error
pip_set_params(p, params = list(nope = 1), unknown = "ignore")
try(pip_set_params(p, params = list(nope = 1), unknown = "error"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.