| stream_group_sum | R Documentation |
Computes sum(value) by group across partitions without collecting. This is
optimized for factor groups (factor_col()).
stream_group_sum(x, group, value, na_rm = TRUE)
x |
A |
group |
Group column name (recommended: |
value |
Numeric column name to sum. |
na_rm |
Logical; drop rows where value is NA (default TRUE). |
A data.frame with columns group (factor) and sum (numeric).
s <- schema(g = factor_col(c("a", "b")), x = float64())
sink <- table_sink(s, mode = "row_groups")
table_write(sink, 1L,
data.frame(g = factor(c("a", "b", "a"), levels = c("a", "b")), x = c(1, 2, 3)))
rg <- table_finalize(sink)
stream_group_sum(rg, "g", "x")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.