Skip to contents

Treats a pipeline as a table of steps: length() and nrow() return the number of steps, ncol() returns the number of columns of the underlying step table, and dim() returns both. Views report only the steps covered by the view.

Usage

# S3 method for class 'pipeflow'
length(x)

# S3 method for class 'pipeflow'
dim(x)

Arguments

x

A pipeflow pipeline or view

Value

  • length(), nrow(): the number of steps

  • ncol(): the number of columns of the step table

  • dim(): vector with the number of steps and columns.

Examples

p <- pip_new() |>
  pip_add("s1", \(x = 1) x) |>
  pip_add("s2", \(x = ~s1) x + 1) |>
  pip_add("s3", \(x = ~s2) x * 2)

dim(p)
#> [1]  3 12
nrow(p)
#> [1] 3
ncol(p)
#> [1] 12
length(p)
#> [1] 3
length(p) == nrow(p) # TRUE
#> [1] TRUE

# A view reports only the number of selected (visible) steps
v <- pip_view(p, step = c("s2", "s3"))
length(v) # 2
#> [1] 2
nrow(v) # 2
#> [1] 2