| d_reduce | R Documentation |
For 2D arrays use dim = "rows" or "cols". For N-d arrays you can
also supply a numeric axis indicating which dimension to collapse.
d_reduce(x, f = base::sum, dim = c("rows", "cols"), axis = NULL, na.rm = FALSE)
x |
A |
f |
A reduction function (defaults to |
dim |
Dimension to reduce: |
axis |
Integer axis to collapse (alternative to |
na.rm |
Logical; remove missing values while reducing. |
A delarr capturing the reduction.
mat <- matrix(1:12, nrow = 3, ncol = 4)
darr <- delarr(mat)
row_sums <- darr |> d_reduce(sum, dim = "rows") |> collect()
row_sums
col_means <- darr |> d_reduce(mean, dim = "cols") |> collect()
col_means
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.