Rescales a numeric vector to a new range.
rescale_vector(
x = NULL,
new.min = 0,
new.max = 1,
integer = FALSE
)
Numeric vector. Default: NULL
New minimum value. Default: 0
New maximum value. Default: 1
Logical, if TRUE
, coerces the output to integer. Default: FALSE
A numeric vector of the same length as x, but with its values rescaled between new.min
and new.max.
if(interactive()){
out <- rescale_vector(
x = rnorm(100),
new.min = 0,
new.max = 100,
integer = TRUE
)
out
}