phi: Normalize a Matrix by Column Min-Max Scaling

View source: R/utils.R

phiR Documentation

Normalize a Matrix by Column Min-Max Scaling

Description

This function performs feature-wise min-max normalization on a matrix or data frame. Each column is rescaled to the range ⁠[0,1]⁠ using its minimum and maximum values. The minimum and maximum values are stored as attributes for later inverse transformation.

Usage

phi(u)

Arguments

u

A numeric matrix or data frame. Each column will be normalized independently.

Value

A numeric matrix of the same dimensions as u, with all values rescaled to ⁠[0,1]⁠. The returned matrix has two attributes:

  • "min_X": A matrix containing the column-wise minima.

  • "max_X": A matrix containing the column-wise maxima.

Examples

# Example matrix
X <- matrix(c(1, 2, 3, 4, 5, 6), ncol = 2)
X_norm <- phi(X)
X_norm
attributes(X_norm)$min_X
attributes(X_norm)$max_X


PLUCR documentation built on March 30, 2026, 5:08 p.m.