Function to center and/or scale the coloumns of a matrix in various ways. The coloumns can be centered with their means or with supplied values, and they can be scaled with their standard deviations or with supplied values.

1 |

`x` |
A matrix. |

`center` |
A logical, or a numeric vector. The values to subtract from each column. If |

`scale` |
A lgical, or a numeric vector. The values to divide each column with. If |

`avoid.zero.divisor` |
A logical. If |

`stdize`

standardizes the coloumns of a matrix by subtracting their means (or the supplied values) and dividing by their standard deviations (or the supplied values).

If `avoid.zero.divisor`

is `TRUE`

, division-by-zero is guarded against by substituting any *0* in `center`

(either calculated or supplied) with *1* prior to division.

The main difference between `stdize`

and `scale`

is that `stdize`

divides by the standard deviations even when `center`

is not `TRUE`

.

A matrix.

Bjørn-Helge Mevik and Øyvind Langsrud

1 2 3 4 5 6 |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.