Normalize numeric vector

normalization(x, method = "max_min", na_rm = TRUE, ...)

Arguments

x

Input numeric vector.

method

Method used for normalization.

na_rm

Whether to remove NA values, and if setting TRUE, using 0 instead.

...

Parameters for other methods.

Value

Normalized numeric vector

Examples

nums <- c(runif(2), NA, -runif(2))
nums
#> [1]  0.5701560  0.9655756         NA -0.6331357 -0.6228825
normalization(nums, method = "max_min")
#> [1] 0.752663571 1.000000000 0.396028802 0.000000000 0.006413423
normalization(nums, method = "maximum")
#> [1]  0.5904831  1.0000000  0.0000000 -0.6557081 -0.6450893
normalization(nums, method = "sum")
#> [1]  0.2042289  0.3458675  0.0000000 -0.2267881 -0.2231154
normalization(nums, method = "softmax")
#> [1] 0.27367666 0.40641178 0.15474696 0.08215893 0.08300566
normalization(nums, method = "z_score")
#> [1]  0.72170569  1.27668258 -0.07851633 -0.96713123 -0.95274070
normalization(nums, method = "mad")
#> [1]  0.6173957  1.0455773  0.0000000 -0.6855935 -0.6744908
normalization(nums, method = "unit_vector")
#> [1]  0.3985782  0.6750037  0.0000000 -0.4426054 -0.4354377
normalization(nums, method = "unit_vector", na_rm = FALSE)
#> [1]  0.3985782  0.6750037         NA -0.4426054 -0.4354377