scale_protti
is used to scale a numeric vector either between 0 and 1 or around a
centered value using the standard deviation. If a vector containing only one value or
repeatedly the same value is provided, 1 is returned as the scaled value for method = "01"
and 0 is returned for metod = "center"
.
scale_protti(x, method)
a numeric vector
a character value that specifies the method to be used for scaling. "01" scales
the vector between 0 and 1. "center" scales the vector equal to base::scale
around a
center. This is done by subtracting the mean from every value and then deviding them by the
standard deviation.
A scaled numeric vector.
scale_protti(c(1, 2, 1, 4, 6, 8), method = "01")
#> [1] 0.0000000 0.1428571 0.0000000 0.4285714 0.7142857 1.0000000