| d_center | R Documentation |
Center a delayed matrix along rows or columns
d_center(x, dim = c("rows", "cols"), axis = NULL, na.rm = FALSE)
x |
A |
dim |
Dimension along which to subtract the mean. |
axis |
Integer axis for N-d arrays (alternative to |
na.rm |
Logical; remove missing values when computing the centre. |
A delarr with a deferred centering operation.
mat <- matrix(c(1, 2, 3, 10, 20, 30), nrow = 2, ncol = 3)
darr <- delarr(mat)
# Center rows (subtract row means)
centered_rows <- darr |> d_center(dim = "rows") |> collect()
centered_rows
rowMeans(centered_rows) # Should be ~0
# Center columns (subtract column means)
centered_cols <- darr |> d_center(dim = "cols") |> collect()
colMeans(centered_cols) # Should be ~0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.