powered by
rescale a numeric vector: map values linearly onto a given range
rescale(x, from = 0, to = 1)
Numerical vector of values to be mapped to a given range
output minimum. DEFAULT: 0
output maximum. DEFAULT: 1
numeric vector, rescaled onto output range
https://stackoverflow.com/a/18303620
scales::rescale
# NOT RUN { rescale(10:15, 135, 200) rescale(10:15, 200, 135) rescale(10:15, to=c(1,5)) values <- rbeta(1e3, shape1=4, shape2=35) hist(rescale(values, 135, 200), breaks=25, col=3) # }
Run the code above in your browser using DataLab