Normalize a vector to fit zero-to-one scale
normalize(x, min = 0, max = 1, na.rm = FALSE)
normalize(mtcars$mpg)
#> [1] 0.4510638 0.4510638 0.5276596 0.4680851 0.3531915 0.3276596 0.1659574
#> [8] 0.5957447 0.5276596 0.3744681 0.3148936 0.2553191 0.2936170 0.2042553
#> [15] 0.0000000 0.0000000 0.1829787 0.9361702 0.8510638 1.0000000 0.4723404
#> [22] 0.2170213 0.2042553 0.1234043 0.3744681 0.7191489 0.6638298 0.8510638
#> [29] 0.2297872 0.3957447 0.1957447 0.4680851