normalize_01: Normalize to 0-1 Range

View source: R/scoring_primitives.R

normalize_01R Documentation

Normalize to 0–1 Range

Description

Applies min-max normalization to a numeric vector, optionally clamping values to [0, 1].

Usage

normalize_01(x, direction = c("higher_better", "lower_better"), clamp = TRUE)

Arguments

x

Numeric vector.

direction

Character. "higher_better" (default) maps max to 1; "lower_better" maps min to 1.

clamp

Logical. If TRUE, clamp output to [0, 1].

Value

Numeric vector normalized to 0–1.

Examples

normalize_01(c(10, 20, 30, 40, 50))
normalize_01(c(10, 20, 30), direction = "lower_better")


r4subcore documentation built on Feb. 20, 2026, 5:09 p.m.