Explicit cache of a function.
make_flow_fn(fn, fn_id = NULL, flow_options = get_flow_options())
fn | Function to be cached, ideally a pure function. |
---|---|
fn_id | Optional id to uniquely identify the function. By default,
rflow functions reuse the |
flow_options | List of options created using |
The cached version of the function.
In order to use the functionality of an R6Flow
object, the output of
make_flow_fn
has to be collected first.
fn <- function(x, y) { x + y + 1 } make_flow_function <- make_flow_fn(fn)#>rflow_function <- make_flow_function(2, 3) flow_result <- rflow_function %>% collect() # usage with rflow pipes fn2 <- function(x, y) { x * y } make_flow_function2 <- make_flow_fn(fn2)#>