Pipelines can get long, and often you want to focus on a subset of steps: a topic, a stage, or the steps that produce the outputs you care about. Views are {pipeflow}’s way of working on a subset of steps without copying anything. A view references the underlying pipeline, so every operation applied to a view (running it, updating parameters, tagging, locking, …) writes through to the original pipeline, restricted to the steps covered by the view.
This vignette shows how to create and combine views, how to select
steps with the [ operator, how views behave when the
pipeline changes, and how to run only part of a pipeline.
Again, we use a very simplified example of a pipeline.
library(pipeflow)
pip <- pip_new("my-pip") |>
pip_add("load", \(n = 5) seq_len(n), tags = c("io", "daily")) |>
pip_add("clean", \(x = ~load) x * 2, tags = c("io", "core")) |>
pip_add("fit", \(x = ~clean) sum(x), tags = c("model", "core")) |>
pip_add("report", \(x = ~fit) paste("result:", x), tags = "report")As you see above, besides step and fun,
pip_add() also allows to set tags. We will use these tags
as meta information to filter certain steps by topic and/or output type.
Let’s do a first run before we move on.
(pip_run(pip, lgr = NULL))
# <pipeflow> my-pip (4 steps)
# ---------------------------
# step params depends state out tags
# 1: load n done 1,2,3,4,5 io,daily
# 2: clean x load done 2, 4, 6, 8,10 io,core
# 3: fit x clean done 30 model,core
# 4: report x fit done result: 30 report
# ---------------------------
# <ready> last run: 2026-10-13 16:15:57pip_view() returns a view of the pipeline that
contains only the steps matching the given filters:
pip_view(pip, tags = "core")
# <pipeflow_view> my-pip (2 of 4 steps)
# -------------------------------------
# step params depends state out tags
# 1: clean x load done 2, 4, 6, 8,10 io,core
# 2: fit x clean done 30 model,core
# -------------------------------------
# <ready> last run: 2026-10-13 16:15:57Filters can be combined. By default, steps must match all filters (logical AND), while the values within a single filter are treated as alternatives (OR):
pip_view(pip, tags = "core", state = "done")
# <pipeflow_view> my-pip (2 of 4 steps)
# -------------------------------------
# step params depends state out tags
# 1: clean x load done 2, 4, 6, 8,10 io,core
# 2: fit x clean done 30 model,core
# -------------------------------------
# <ready> last run: 2026-10-13 16:15:57
pip_view(pip, step = c("clean", "fit"))
# <pipeflow_view> my-pip (2 of 4 steps)
# -------------------------------------
# step params depends state out tags
# 1: clean x load done 2, 4, 6, 8,10 io,core
# 2: fit x clean done 30 model,core
# -------------------------------------
# <ready> last run: 2026-10-13 16:15:57join = "union" keeps steps that match any
filter:
pip_view(pip, tags = "report", step = "clean", join = "union")
# <pipeflow_view> my-pip (2 of 4 steps)
# -------------------------------------
# step params depends state out tags
# 1: clean x load done 2, 4, 6, 8,10 io,core
# 2: report x fit done result: 30 report
# -------------------------------------
# <ready> last run: 2026-10-13 16:15:57With fixed = FALSE, filter values are interpreted as
regular expressions:
pip_view(pip, step = "^f", fixed = FALSE)
# <pipeflow_view> my-pip (1 of 4 steps)
# -------------------------------------
# step params depends state out tags
# 1: fit x clean done 30 model,core
# -------------------------------------
# <ready> last run: 2026-10-13 16:15:57The available filters are step, params,
state, exec, tags, and
depends. For example, to find all steps that depend on
load and are still new:
[The extract operator [ provides a data.table-like way of
selecting steps. It returns a view by default:
pip_run(pip, lgr = NULL)
pip[c("load", "fit")]
# <pipeflow_view> my-pip (2 of 4 steps)
# -------------------------------------
# step params depends state out tags
# 1: load n done 1,2,3,4,5 io,daily
# 2: fit x clean done 30 model,core
# -------------------------------------
# <ready> last run: 2026-10-13 16:15:59
pip[1:3]
# <pipeflow_view> my-pip (3 of 4 steps)
# -------------------------------------
# step params depends state out tags
# 1: load n done 1,2,3,4,5 io,daily
# 2: clean x load done 2, 4, 6, 8,10 io,core
# 3: fit x clean done 30 model,core
# -------------------------------------
# <ready> last run: 2026-10-13 16:15:59Boolean filters are evaluated in the context of the step table, so
the same columns as in pip_view() are available as
variables:
pip[tags %like% "core"]
# <pipeflow_view> my-pip (2 of 4 steps)
# -------------------------------------
# step params depends state out tags
# 1: clean x load done 2, 4, 6, 8,10 io,core
# 2: fit x clean done 30 model,core
# -------------------------------------
# <ready> last run: 2026-10-13 16:15:59
pip[step %in% c("clean", "fit") & state == "done"]
# <pipeflow_view> my-pip (2 of 4 steps)
# -------------------------------------
# step params depends state out tags
# 1: clean x load done 2, 4, 6, 8,10 io,core
# 2: fit x clean done 30 model,core
# -------------------------------------
# <ready> last run: 2026-10-13 16:15:59Note that %like% matches the tags of each step as a
single string, such as 'c("model", "core")', or
"character(0)" for a step without tags. A pattern can
therefore match more steps than intended, so to select steps by their
tags, pip_view(tags = ) is the safer choice.
Negative indices select all steps except the excluded ones:
pip[-2]
# <pipeflow_view> my-pip (3 of 4 steps)
# -------------------------------------
# step params depends state out tags
# 1: load n done 1,2,3,4,5 io,daily
# 2: fit x clean done 30 model,core
# 3: report x fit done result: 30 report
# -------------------------------------
# <ready> last run: 2026-10-13 16:15:59p[] returns a copy of the pipeline, and using two
indices (p[i, j]) extracts the given rows and columns as a
data.table:
pip2 <- pip[]
pip[, c("step", "tags")]
# step tags
# <char> <list>
# 1: load io,daily
# 2: clean io,core
# 3: fit model,core
# 4: report report
pip[c("load", "fit"), "out"]
# out
# <list>
# 1: 1,2,3,4,5
# 2: 30While [ returns a view by default,
view = FALSE builds a new, self-contained pipeline
containing the selected steps together with all their upstream
dependencies:
pip[c("fit", "report"), view = FALSE]
# pulled in 2 upstream dependencies
# <pipeflow> my-pip (4 steps)
# ---------------------------
# step params depends state out tags
# 1: load n done 1,2,3,4,5 io,daily
# 2: clean x load done 2, 4, 6, 8,10 io,core
# 3: fit x clean done 30 model,core
# 4: report x fit done result: 30 report
# ---------------------------
# <ready> last run: neverThe printed message tells you how many steps were pulled in as upstream dependencies.
Views can be nested: applying pip_view() (or
[) to a view narrows the view further.
v1 <- pip_view(pip, tags = "io") # load, clean
v1
# <pipeflow_view> my-pip (2 of 4 steps)
# -------------------------------------
# step params depends state out tags
# 1: load n done 1,2,3,4,5 io,daily
# 2: clean x load done 2, 4, 6, 8,10 io,core
# -------------------------------------
# <ready> last run: 2026-10-13 16:15:59
v2 <- v1 |> pip_view(tags = "core") # clean only
v2
# <pipeflow_view> my-pip (1 of 4 steps)
# -------------------------------------
# step params depends state out tags
# 1: clean x load done 2, 4, 6, 8,10 io,core
# -------------------------------------
# <ready> last run: 2026-10-13 16:15:59view meta fieldUnder the hood, a view stores the steps it covers in the
view meta field of the pipeline object (NULL
for a full pipeline). Reading the field returns the names of the covered
steps, so in principle you can also manipulate the view directly by
assigning step names to the meta field1.
pip[["view"]] # NULL — not a view
# NULL
w <- pip
w[["view"]] <- c("load", "clean")
w
# <pipeflow_view> my-pip (2 of 4 steps)
# -------------------------------------
# step params depends state out tags
# 1: load n done 1,2,3,4,5 io,daily
# 2: clean x load done 2, 4, 6, 8,10 io,core
# -------------------------------------
# <ready> last run: 2026-10-13 16:15:59
w[["view"]] <- NULL # back to the full pipeline
w
# <pipeflow> my-pip (4 steps)
# ---------------------------
# step params depends state out tags
# 1: load n done 1,2,3,4,5 io,daily
# 2: clean x load done 2, 4, 6, 8,10 io,core
# 3: fit x clean done 30 model,core
# 4: report x fit done result: 30 report
# ---------------------------
# <ready> last run: 2026-10-13 16:15:59A view keeps covering its steps when the pipeline changes later, no matter whether the change is made through the view, another view, or the pipeline itself. Renamed steps stay in the view under their new name, and removed steps drop out of it. New steps are not added to an existing view, even if they match the view’s filters.
q <- pip_clone(pip)
v <- pip_view(q, tags = "core")
v
# <pipeflow_view> my-pip (2 of 4 steps)
# -------------------------------------
# step params depends state out tags
# 1: clean x load done 2, 4, 6, 8,10 io,core
# 2: fit x clean done 30 model,core
# -------------------------------------
# <ready> last run: never
# A new "core" step is not added to the existing view
pip_add(q, "check", \(x = ~clean) all(x > 0), tags = "core", after = "clean")
# A renamed step stays in the view under its new name
pip_rename(q, from = "fit", to = "model")
v
# <pipeflow_view> my-pip (2 of 5 steps)
# -------------------------------------
# step params depends state out tags
# 1: clean x load done 2, 4, 6, 8,10 io,core
# 2: model x clean done 30 model,core
# -------------------------------------
# <ready> last run: never
# Removed steps drop out of the view
pip_remove(q, "model", force = TRUE)
# Removing step 'model' and its downstream dependencies: 'report'
v
# <pipeflow_view> my-pip (1 of 3 steps)
# -------------------------------------
# step params depends state out tags
# 1: clean x load done 2, 4, 6, 8,10 io,core
# -------------------------------------
# <ready> last run: neverRunning a view executes the covered steps together with any upstream
dependencies that are not up to date. The run log marks steps that
belong to the view as [view] and steps that were pulled in
as dependencies as [upstream]:
pip_reset(pip)
pip_run(pip_view(pip, step = "report"))
# info [2026-10-13 14:16:02.871 UTC]: Starting run of pipeflow 'my-pip'
# info [2026-10-13 14:16:02.872 UTC]: Step 1/4 [upstream] load
# info [2026-10-13 14:16:02.872 UTC]: Step 2/4 [upstream] clean
# info [2026-10-13 14:16:02.873 UTC]: Step 3/4 [upstream] fit
# info [2026-10-13 14:16:02.874 UTC]: Step 4/4 [view] report
# info [2026-10-13 14:16:02.875 UTC]: Finished run of pipeflow 'my-pip'Afterwards, the original pipeline is up to date for the covered steps.
Pipeline views are not only useful to inspect or run certain parts of the pipeline but also to filter and collect the final output of your analysis run. For more details on this see the next vignette Collect and group output.
Direct manipulation of the view usually is not needed and probably mostly useful for debugging.↩︎