colCenterScale {pipeComp} | R Documentation

## colCenterScale

### Description

Matrix scaling by centering columns separately and then performing variance scaling on the whole matrix, in a NA-robust fashion. With the default arguments, the output will be the number of (matrix-)median absolute deviations from the column-median.

### Usage

    colCenterScale(
      x,
      centerFn = median,
      scaleFn = function(x, na.rm) median(abs(x), na.rm = na.rm)
    )

### Arguments

`x` | A numeric matrix.
`centerFn` | The function for calculating centers. Should accept the 'na.rm' argument. E.g. 'centerFn=mean' or 'centerFn=median'.
`scaleFn` | The function for calculating the (matrix-wise) scaling factor. Should accept the 'na.rm' argument. Default 'median(abs(x))'.

### Value

A scaled matrix of the same dimensions as 'x'.

### Examples

    # random data with column mean differences
    d <- cbind(A=rnorm(5, 10, 2), B=rnorm(5, 20, 2), C=rnorm(5,30, 2))
    colCenterScale(d)

[Package pipeComp version 1.0.0 Index]