normalize: Normalize a numeric vector to a specified range

View source: R/Normalize.R

normalizeR Documentation

Normalize a numeric vector to a specified range

Description

The normalize function takes a numeric vector and normalizes its values to a specified range.

Usage

normalize(x, range = c(0, 1))

Arguments

x

A numeric vector to be normalized.

range

A numeric vector specifying the desired range. The default range is 0, 1.

Value

A numeric vector with values normalized to the specified range.

See Also

scale

Examples

x <- c(1, 2, 3, 4, 5)
normalize(x)  # Normalize x to the default range [0, 1]
normalize(x, range = c(0, 100))  # Normalize x to the range [0, 100]


moritzlindner/PatchMasteR documentation built on April 30, 2024, 1:52 a.m.