This is a simple function copied from the scales package (almost the same).

rescale(x, to)

Arguments

x

a numeric vector

to

a numeric vector of length 2. The new range of values.