colCenterScale {pipeComp} | R Documentation |
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.
colCenterScale( x, centerFn = median, scaleFn = function(x, na.rm) median(abs(x), na.rm = na.rm) )
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))'. |
A scaled matrix of the same dimensions as 'x'.
# 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)