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] 67.666948 53.016126 55.551743 94.227105 22.140170 20.727562
#> [7] 62.040584 39.813741 58.808826 37.521960 71.744628 56.642760
#> [13] 29.426574 36.416012 42.536924 17.271771 60.931912 85.830564
#> [19] 65.216685 86.204445 61.431005 61.470642 45.202545 59.058821
#> [25] 71.903646 58.969574 31.870206 14.821021 36.761842 24.274398
#> [31] 46.466466 0.000000 10.836950 46.792071 47.426332 49.573230
#> [37] 50.926042 71.637216 60.670084 44.483031 40.487754 40.380079
#> [43] 50.894093 52.885050 47.242755 46.457468 48.278805 23.796679
#> [49] 20.522340 43.263962 55.696293 62.375344 38.175476 24.828372
#> [55] 29.161294 67.647535 37.571646 30.842398 48.981810 6.446845
#> [61] 65.552267 44.941620 100.000000 21.021588 53.948666 6.697004
#> [67] 76.075006 39.636354 75.457832 82.325492 26.361247 53.242381
#> [73] 40.733321 38.080695 42.703995 78.290511 51.958248 36.059361
#> [79] 75.360421 47.441552 52.909362 77.252572 30.211724 54.239055
#> [85] 31.073980 54.347588 68.999726 50.271724 78.087040 51.267281
#> [91] 32.302179 50.114475 33.625441 72.682300 43.158027 27.564798
#> [97] 52.215058 30.966292 42.112078 57.301241