pipeline: Evaluate an expression pipeline

Description Usage Arguments Details Examples

View source: R/pipeline.R

Description

Evaluate an expression pipeline enclosed by {} or a sequence of expressions as as pipeline. This functions works to chain expressions without using %>>% operator but produce the same result.

Usage

1

Arguments

...

Pipeline expressions. Supply multiple pipeline expressions as arguments or only an enclosed expression within {} as the first argument.

Details

When pipeline(...) is called with multiple arguments, the arguments will be regarded as pipeline expressions.

When pipeline(...) is called with a single argument, the argument is expected to be a block expression enclosed by {} in which each expression will be regarded as a pipeline expression.

The pipeline expressions will be chained sequentially by %>>% and be evaluated to produce the same results as if using the pipe operator.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
pipeline(1:10, sin, sum)

pipeline(1:10, plot(col = "red", type = "l"))

pipeline(mtcars,
  lm(formula = mpg ~ cyl + wt),
  summary,
  coef)

pipeline({
  mtcars
  lm(formula = mpg ~ cyl + wt)
  summary
  coef
})

pipeline({
  mtcars
  "Sample data" ? head(., 3)
  lm(formula = mpg ~ cyl + wt)
  ~ lmodel
  summary
  ? .$r.squared
  coef
})

pipeline({
 mtcars
 "estimating a linear model ..."
 lm(formula = mpg ~ cyl + wt)
 "summarizing the model ..."
 summary
})

pipeR documentation built on May 29, 2017, 9:41 a.m.