normalize {traumar} | R Documentation |
Normalize a Numeric Vector
Description
This function normalizes a numeric or integer vector using one of two methods: min-max normalization (scales data to the range (0, 1)) or z-score normalization (centers data around 0 with a standard deviation of 1).
Usage
normalize(x, method = c("min_max", "z_score"))
Arguments
x |
A numeric or integer vector to be normalized. |
method |
A character string specifying the normalization method. Options
are |
Value
A numeric vector of the same length as x
, containing the
normalized values.
Author(s)
Nicolas Foss, Ed.D., MS
Examples
# Example data
data <- c(10, 20, 30, 40, 50, NA)
# Min-max normalization
normalize(data, method = "min_max")
# Z-score normalization
normalize(data, method = "z_score")
# Default behavior (min-max normalization)
normalize(data)
[Package traumar version 1.2.1 Index]