collect.R6Flow: Get the data from an 'R6Flow' or an 'Element' object

Description Usage Arguments Value Examples

View source: R/flow-functions.R

Description

Get the data from an R6Flow or an Element object

Usage

1
2
3
4
5
## S3 method for class 'R6Flow'
collect(x, ...)

## S3 method for class 'Element'
collect(x, ...)

Arguments

x

A flow object, e.g. as returned by flow_fn.

...

Name of the element of the output data to be selected. If present, it must be named name, otherwise the first item of the ... list will be used. The default is name = NULL, which returns all the data. Ignored if x is an Element object.

Value

Data associated with the output of the function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
fn <- function(x, y) { x + y + 4 }
flowed_fn <- flow_fn(2, 3, fn = fn) 
flow_result <- flowed_fn %>% collect()

fn <- function(x, y) { list(x = x, y = y, z = 5) }
flowed_fn <- flow_fn(2, 3, fn = fn)
flow_result <- flowed_fn %>%
    collect()
flow_element <- element(flowed_fn, "x")
collected_element_value <- collect(flow_element)

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