Learn R Programming

nda (version 0.3.0)

normalize: Fast Min-Max Normalization

Description

Rescales a numeric matrix or data frame globally, by row, or by column.

Usage

normalize(x, type = c("all", "row", "col"), range = c(0, 1),
          na.rm = TRUE)

Value

A normalized object with the same matrix or data-frame form as x.

Arguments

x

Numeric matrix or data frame.

type

Normalize all values together, each row, or each column.

range

Two increasing finite output limits.

na.rm

Remove missing values when finding limits.

Details

A constant slice is mapped to the midpoint of range.

Examples

Run this code
m <- matrix(rnorm(20), 5, 4)
normalize(m)
normalize(m, type = "row", range = c(-1, 1))

Run the code above in your browser using DataLab