Function used to rescale a vector to a given value. This is a frequently needed operation.
rescale_vector(x, scale = 1)
x | numeric vector. |
---|---|
scale | numeric. Value the vector should sum to. Default 1. |
The vector rescaled.
For a distribution, use scale = 1
. For percentages, use scale = 100
, etc.
#> [1] 4.638806#> [1] 100