normalize.vector {quickcode} | R 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))
[Package quickcode version 1.0.8 Index]