A helper function -- normalise/rescale values so that they fit into a range from 0 to 1. (The minimum value becomes 0 and the maximum value becomes 1).

normalise(numvec)

Arguments

numvec

A numeric vector

Value

A numeric vector with values in the range [0,1].

Examples

x <- seq(from=-3.7, to=6.5, by=1.36) y <- normalise(x) data.frame(x,y)
#> x y #> 1 -3.70 0.0000000 #> 2 -2.34 0.1428571 #> 3 -0.98 0.2857143 #> 4 0.38 0.4285714 #> 5 1.74 0.5714286 #> 6 3.10 0.7142857 #> 7 4.46 0.8571429 #> 8 5.82 1.0000000