pip_view: Create a pipeline view

View source: R/pipeline.R

pip_viewR Documentation

Create a pipeline view

Description

Creates a filtered view showing only a selected subset of steps. A view references the underlying pipeline without copying it, so operations like pip_run() and pip_set_params() applied to a view affect only the selected steps.

Usage

pip_view(
  x,
  i = integer(),
  filter = list(),
  tags = character(),
  fixed = TRUE,
  ...
)

Arguments

x

A pipeflow pipeline or view.

i

Optional row indices or step names to keep.

filter

A named list of filters to apply. Each element can be a character vector specifying the values to keep for the corresponding property or, if fixed is FALSE, a regular expression. See examples for usage.

tags

Tag filter (character). Keeps steps with any matching tag.

fixed

If TRUE, values in filter are treated as fixed strings, otherwise they are treated as regular expressions.

...

further args passed to grepl (only in effect when fixed is FALSE).

Value

A pipeflow_view object.

Examples


p <- pip_new()
pip_add(p, "load_raw", \(x = 1) x,
  tags = c("io", "core", "daily")
)
pip_add(p, "fit_model", \(x = 2) x + 1,
  tags = c("model")
)
pip_add(p, "eval_model", \(x = ~fit_model) x,
  tags = c("model", "daily", "report")
)

# Filter by a fixed column value (one or more states)
pip_view(p, filter = list(state = "new"))

# Combine filters: step pattern AND state
pip_view(p, filter = list(step = "model", state = "new"))

# Filter by tag — keeps steps that have *any* of the given tags
pip_view(p, tags = "daily")

# Combine explicit step selection with a filter (intersection)
pip_view(p,
  i      = c("load_raw", "fit_model"),
  filter = list(state = "new")
)

# Select by integer row indices
pip_view(p, i = c(1L, 2L), filter = list(state = "new"))

# Use a regex pattern to match step names
pip_view(p, filter = list(step = "_model$"), fixed = FALSE)

# Views are composable: create a view-of-view for progressive narrowing
v1 <- pip_view(p, tags = "daily")
print(v1) # load_raw, eval_model
v2 <- pip_view(v1, tags = "report")
print(v2) # eval_model only

pipeflow documentation built on June 15, 2026, 9:10 a.m.