normalize.vector: Normalize a Numeric Vector to the Range [0, 1]

View source: R/aided_chatgpt.R

normalize.vectorR Documentation

Normalize a Numeric Vector to the Range [0, 1]

Description

This function normalizes a numeric vector so that all values are scaled to the range [0, 1].

Usage

normalize.vector(x)

Arguments

x

A numeric vector to be normalized.

Value

A numeric vector with values scaled to the range [0, 1]. If all values are identical, all values are set to 0.

Examples

# Example with a numeric vector
normalize.vector(c(1, 2, 3, 4, 5))

# Example with a vector containing identical values
normalize.vector(c(3, 3, 3))


quickcode documentation built on April 11, 2025, 5:49 p.m.