Equivalent to centering and scaling with unit variance.
Usage
d_zscore(x, dim = c("rows", "cols"), na.rm = FALSE)Examples
mat <- matrix(c(1, 2, 3, 10, 20, 30), nrow = 2, ncol = 3)
darr <- delarr(mat)
# Z-score normalize rows
zscored <- darr |> d_zscore(dim = "rows") |> collect()
zscored
#> [,1] [,2] [,3]
#> [1,] -0.6704784 -0.4789131 1.149392
#> [2,] -0.8320503 -0.2773501 1.109400
# Row means should be ~0, row SDs should be ~1
rowMeans(zscored)
#> [1] -1.850372e-17 0.000000e+00