demean

Syntax

demean(X)

Arguments

X is a numeric scalar/vector/matrix/table.

Details

Center a dataset (zero-centering), and return an object of type DOUBLE with the same dimension as X. NULL values are ignored in the calculation.

  • If X is a vector, calculate X - avg(X);

  • If X is a matrix, perform calculations by columns;

  • If X is a table, perform calculations only for numeric columns.

Examples

$ x = 1 NULL 2 3
$ demean(x)
[-1,,0,1]

$ v = 1 0 1 1 8 2 -4 0
$ demean(v)
[-0.125,-1.125,-0.125,-0.125,6.875,0.875,-5.125,-1.125]