rescale_vector | R Documentation |
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. |
For a distribution, use scale = 1
. For percentages, use scale = 100
, etc.
The vector rescaled.
x <- runif(10)
sum(x)
xx <- rescale_vector(x,100)
sum(xx)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.