rescale | R Documentation |
This function will take a variable and transform it such that it has a particular mean and variance
rescale(x, new.mean, new.sd)
x |
A vector containing the data the user wishes to transform |
new.mean |
The desired mean of the dataset |
new.sd |
The desired sd of the dataset |
a vector of rescaled values
Dustin Fife
x = rnorm(100, 0, 1)
## transform to have a mean of 20 and sd of 5
x.new = rescale(x, 50, 5)
mean(x.new); sd(x.new)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.