Rescale Numeric Vector to a New Data Range
See also
Other tsl_processing_internal:
utils_drop_geometry()
,
utils_global_scaling_params()
,
utils_optimize_loess()
,
utils_optimize_spline()
Examples
out <- utils_rescale_vector(
x = stats::rnorm(100),
new_min = 0,
new_max = 100,
)
out
#> [1] 60.58326 68.08649 29.61592 26.02562 22.54793 46.31593 90.15495
#> [8] 45.99009 39.94559 99.04676 51.68423 39.36212 35.54525 39.05535
#> [15] 56.21974 70.27341 29.07427 56.86018 29.56933 50.10348 59.48383
#> [22] 40.64127 58.35954 80.85906 58.67526 63.36015 77.19324 77.54117
#> [29] 56.57134 55.63675 84.28672 58.19284 73.89180 44.69188 47.06974
#> [36] 76.14333 38.29530 46.35639 64.60923 72.87888 71.55514 20.73025
#> [43] 52.71706 17.55250 35.27803 38.12257 50.07673 46.16950 40.18640
#> [50] 48.26363 26.93864 0.00000 44.16296 60.71259 60.67377 59.98880
#> [57] 21.88769 51.47359 31.56147 63.60514 54.56890 54.01329 86.50080
#> [64] 50.61243 25.04218 64.89142 43.42810 99.56273 57.92798 22.20592
#> [71] 51.53800 50.63630 37.91046 49.34914 59.95146 100.00000 71.79212
#> [78] 86.31045 62.56162 47.48080 60.38708 25.44992 74.91464 57.57276
#> [85] 92.38712 68.16589 30.32619 51.79438 71.36716 55.56505 28.73002
#> [92] 60.45489 60.57522 49.18724 65.38480 62.97162 79.92543 52.82335
#> [99] 43.35337 54.69993