Implicit cache of a function and of the given call.

flow_fn(..., fn = NULL, fn_id = NULL,
  flow_options = get_flow_options())

Arguments

...

Named arguments to pass to fn.

fn

The function to apply to the data frame. It must accept a data frame as the first argument and a numeric index as the second argument.

fn_id

Optional id to uniquely identify the function. By default, rflow functions reuse the cache if the same function is given. The id allows the user to suppress console messages and to explicitly indicate whether to reuse the old cache or create a new one.

flow_options

List of options created using get_flow_options.

Value

The flow object.

Details

Arguments fn, fn_id and flow_options, when provided, must be named. Argument fn must be always provided.

Examples

fn <- function(x, y) { x + y + 2 } flowed_fn <- flow_fn(2, 3, fn = fn)
#> New cache: fn=fn / fn_id=1 / fn_key=161bf86e1ec4d44b
collected_result <- flowed_fn %>% collect() # usage with rflow pipes fn2 <- function(x, y) { x * y } collected_pipe_result <- flowed_fn %>% flow_fn(2, fn = fn2) %>% collect()
#> New cache: fn=fn2 / fn_id=1 / fn_key=744dc98f5cf70f9b