pipe_append {pipeflow} | R Documentation |
Append two pipelines
Description
When appending, pipeflow
takes care of potential name
clashes with respect to step names and dependencies, that is, if
needed, it will automatically adapt step names and dependencies to
make sure they are unique in the merged pipeline.
Usage
pipe_append(pip, p, outAsIn = FALSE, tryAutofixNames = TRUE, sep = ".")
Arguments
pip |
|
p |
|
outAsIn |
|
tryAutofixNames |
|
sep |
|
Value
returns new combined Pipeline
object.
Examples
# Append pipeline
p1 <- pipe_new("pipe1")
pipe_add(p1, "step1", \(x = 1) x)
p2 <- pipe_new("pipe2")
pipe_add(p2, "step2", \(y = 1) y)
p1 |> pipe_append(p2)
# Append pipeline with potential name clashes
p3 <- pipe_new("pipe3")
pipe_add(p3, "step1", \(z = 1) z)
p1 |> pipe_append(p2) |> pipe_append(p3)
# Use output of first pipeline as input for second pipeline
p1 <- pipe_new("pipe1", data = 8)
p2 <- pipe_new("pipe2")
pipe_add(p1, "square", \(x = ~data) x^2)
pipe_add(p2, "log2", \(x = ~data) log2(x))
p12 <- p1 |> pipe_append(p2, outAsIn = TRUE)
p12 |> pipe_run() |> pipe_get_out("log2")
p12
# Custom name separator for adapted step names
p1 |> pipe_append(p2, sep = "___")
[Package pipeflow version 0.2.2 Index]