# standardize: Data standardization

## Description

Standardize data with given functions for computing center and scale.

## Usage

standardize(x, centerFun = mean, scaleFun = sd)robStandardize(x, centerFun = median, scaleFun = mad, fallback = FALSE,
eps = .Machine$double.eps, ...)

## Arguments

x

a numeric vector, matrix or data frame to be standardized.

centerFun

a function to compute an estimate of the center of a
variable (defaults to `mean`

).

scaleFun

a function to compute an estimate of the scale of a
variable (defaults to `sd`

).

fallback

a logical indicating whether standardization with
`mean`

and `sd`

should be performed as a
fallback mode for variables whose robust scale estimate is too small. This
is useful, e.g., for data containing dummy variables.

eps

a small positive numeric value used to determine whether the
robust scale estimate of a variable is too small (an effective zero).

## Value

An object of the same type as the original data `x`

containing
the centered and scaled data. The center and scale estimates of the
original data are returned as attributes `"center"`

and `"scale"`

,
respectively.

## Details

`robStandardize`

is a wrapper function for robust standardization,
hence the default is to use `median`

and
`mad`

.

## Examples

# NOT RUN {
## generate data
set.seed(1234) # for reproducibility
x <- rnorm(10) # standard normal
x[1] <- x[1] * 10 # introduce outlier
## standardize data
x
standardize(x) # mean and sd
robStandardize(x) # median and MAD
# }