Get the data from an R6Flow or an Element object.

# S3 method for R6Flow
collect(x, ...)

# S3 method for 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

fn <- function(x, y) { x + y + 4 } flowed_fn <- flow_fn(2, 3, fn = fn)
#> New cache: fn=fn / fn_id=1 / fn_key=0e630ff889893c98
flow_result <- flowed_fn %>% collect() fn <- function(x, y) { list(x = x, y = y, z = 5) } flowed_fn <- flow_fn(2, 3, fn = fn)
#> New cache: fn=fn / fn_id=1 / fn_key=882d40ed12e5dd49
flow_result <- flowed_fn %>% collect() flow_element <- element(flowed_fn, "x") collected_element_value <- collect(flow_element)