pipeR (version 0.6.1.3)

pipeline: Evaluate an expression pipeline

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

pipeline(...)

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

Run this code
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
})

Run the code above in your browser using DataLab