Internal helper function that centers and scales each column of a matrix.
If offset (column means) and scale (column SDs) are not provided,
they are computed from the data.
Arguments
- x
A numeric matrix of covariates.
- offset
Optional numeric vector of column means to subtract. If
NULL, column means are computed fromx.- scale
Optional numeric vector of column standard deviations to divide by. If
NULL, column SDs are computed fromx. Any zero SD is replaced with 1 to avoid division-by-zero.