Learn R Programming

fMRItools (version 0.7.2)

scale_med: Robust scaling

Description

Centers and scales the columns of a matrix robustly

Usage

scale_med(mat, TOL = 1e-08, drop_const = TRUE, doRows = FALSE)

Value

The input matrix with its columns centered and scaled.

Arguments

mat

A numeric matrix. Its columns will be centered and scaled.

TOL

Columns with MAD below this value will be considered constant. Default: 1e-8

drop_const

Drop constant columns? Default: TRUE. If FALSE, set to NA instead.

doRows

Center and scale the rows instead? Default: FALSE.

Details

Centers each column on its median, and scales each column by its median absolute deviation (MAD). If there are constant-valued columns, they are removed if drop_const or set to NA if !drop_const, and a warning is raised. If all columns are constant, an error is raised.