split_pipeline takes an expression of a pipeline and splits it into a list of unevaluated calls.

split_pipeline(pipeline, ...)

Arguments

pipeline

A pipeline. Can be an unquoted or quoted expression, or a character vector of code. If missing, uses the text highlighted in RStudio's source editor.

...

Only used to allow assignment with = at the beginning of a pipeline.

Value

A list of unevaluated calls extracted from the pipeline.

Details

split_pipeline does not split nested pipelines.

See also

The unexported magrittr:::split_chain, does not handle assignment, but collects the particular pipes used. burst_pipes invisibly returns a restructured split pipeline.

Examples

# \donttest{ library(magrittr) split_pipeline( quote(x <- 1:5 %>% rev %>% {. * 2} %>% sample(replace = TRUE)) )
#> [[1]] #> x <- 1:5 #> #> [[2]] #> rev #> #> [[3]] #> { #> . * 2 #> } #> #> [[4]] #> sample(replace = TRUE) #>
# }