scale_range(x, to, na.rm = getOption("transx.na.rm")) scale_minmax(x, na.rm = getOption("transx.na.rm")) scale_unit_len(x, na.rm = getOption("transx.na.rm"))
x |
Univariate vector, numeric or ts object with only one dimension. |
---|---|
to |
Values that will determine the output range. |
na.rm |
A value indicating whether NA values should be stripped before the computation proceeds. |
Returns a vector with the same class and attributes as the input vector.
To rescale a range between an arbitrary set of values [a, b], the formula becomes:
#> [1] 2.00 0.75 -0.25 -1.00scale_minmax(x)#> [1] 1.0000000 0.5833333 0.2500000 0.0000000