Steps to be added to either the pipeline steps or spider steps.

parser(.f, name = paste(.f, collapse = ""), flatten = T, apply = NA)

transformer(.f, name = paste(.f, collapse = ""))

Arguments

.f

formula to be used in the step that accepts the input .x and optional .y parameters

name

The name of the object

flatten

whether or not to flatten the result of the parser

apply

a function to apply to your parser function if you don't want to use purrr::map()

Examples

p_mult_2 <- parser( ~ .x * 2, name = "multply by two")
p_mult_2
#> ( 1 ) A parser: multply by two 

run(p_mult_2, 1:5)
#> Executing parser  multply by two 
#> [[1]]
#> [1] 2
#> 
#> [[2]]
#> [1] 4
#> 
#> [[3]]
#> [1] 6
#> 
#> [[4]]
#> [1] 8
#> 
#> [[5]]
#> [1] 10
#> 

t_sum <- transformer(~ sum(.x), name = "get sum")
t_sum
#> ( 1 ) A transformer: get sum 

run(t_sum, 1:5)
#> Executing transformer  get sum 
#> [1] 15