d_zscore: Z-score a delayed matrix

View source: R/delarr-verbs.R

d_zscoreR Documentation

Z-score a delayed matrix

Description

Equivalent to centering and scaling with unit variance.

Usage

d_zscore(x, dim = c("rows", "cols"), axis = NULL, na.rm = FALSE)

Arguments

x

A delarr.

dim

Dimension over which to compute the z-score.

axis

Integer axis for N-d arrays (alternative to dim).

na.rm

Logical; remove missing values when computing statistics.

Value

A delarr with the z-score applied lazily.

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

# Row means should be ~0, row SDs should be ~1
rowMeans(zscored)

delarr documentation built on July 1, 2026, 1:06 a.m.