minmax: Min-Max Normalization

View source: R/minmax.R

minmaxR Documentation

Min-Max Normalization

Description

This function rescales a numeric vector using the min-max normalization technique, which linearly transforms the values to a new range specified by the a and b arguments. The minimum value in the original vector is mapped to a, and the maximum value is mapped to b.

Usage

minmax(x, a = 0, b = 1, drop_na = TRUE, drop.na = deprecated())

Arguments

x

A numeric vector.

a

The minimum value of the new range (default: 0).

b

The maximum value of the new range (default: 1).

drop_na

A logical value indicating whether to remove missing values (NA). If TRUE (the default), missing values are removed from the output. If FALSE, they are kept (as NA) and ignored when computing the range.

drop.na

[Deprecated] Use drop_na.

Value

A numeric vector with values rescaled to the new range ⁠[a, b]⁠.

Author(s)

Christian L. Goueguel

Examples

data(forageLIBS)
head(minmax(forageLIBS$K))
head(minmax(forageLIBS$S, a = -1, b = 1, drop_na = FALSE))

specProc documentation built on Nov. 20, 2026, 5:11 p.m.