flow_fn: Implicit cache of a function and of the given call

Description Usage Arguments Details Value Examples

View source: R/flow-functions.R

Description

Implicit cache of a function and of the given call

Usage

1
2

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.

Details

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

Value

The flow object.

Examples

1
2
3
4
5
6
7
8
9
fn <- function(x, y) { x + y + 2 }
flowed_fn <- flow_fn(2, 3, fn = fn)
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()

numeract/rflow documentation built on May 28, 2019, 3:39 p.m.