powered by
Scales a numeric vector to a specific range, typically [0, 1]. This method is sensitive to outliers.
norm_minmax(x, min_val = 0, max_val = 1, na.rm = TRUE)
A numeric vector scaled to the range [min_val, max_val].
A numeric vector.
The minimum value of the target range. Default is 0.
The maximum value of the target range. Default is 1.
Logical. Should NA values be removed during min/max calculation? Default is TRUE.
TRUE
Formula: \(x' = \frac{x - \min(x)}{\max(x) - \min(x)} \times (\text{max\_val} - \text{min\_val}) + \text{min\_val}\)
Han, J., Kamber, M., & Pei, J. (2011). Data mining: concepts and techniques (3rd ed.). Morgan Kaufmann.
norm_minmax(c(1, 2, 3, 4, 5)) norm_minmax(c(1, 2, 3), min_val = -1, max_val = 1)
Run the code above in your browser using DataLab