| stream_reduce | R Documentation |
Applies f() to each partition (row-group) and combines results with
combine() into a single accumulator. This keeps peak memory bounded by the
largest single partition (plus your accumulator).
stream_reduce(x, f, init, combine, ...)
## S3 method for class 'shard_row_groups'
stream_reduce(x, f, init, combine, ...)
## S3 method for class 'shard_dataset'
stream_reduce(x, f, init, combine, ...)
x |
A |
f |
Function |
init |
Initial accumulator value. |
combine |
Function |
... |
Passed to |
The final accumulator value after processing all partitions.
s <- schema(x = float64())
sink <- table_sink(s, mode = "row_groups")
table_write(sink, 1L, data.frame(x = rnorm(5)))
rg <- table_finalize(sink)
total <- stream_reduce(rg, f = nrow, init = 0L, combine = `+`)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.