scale2 | R Documentation |
Scale a variable to a new mean and standard deviation
scale2(x, newmean = 0, newsd = 1, yj = F)
x |
Data to scale |
newmean |
Desired mean |
newsd |
Desired standard deviation |
yj |
[logical] Whether Yeo-Johnson transformation should be applied to minimize univariate skew |
y <- c(rnorm(200,3,3),rnorm(100,10,3) )
hist(y, breaks = 40)
hist(scale2(y,4,2), breaks = 40)
hist(scale2(y,-1,.5), breaks = 40)
hist(scale2(y,10,1,yj=T),breaks = 40)
hist(scale2(exp(y),10,1,yj=F),breaks = 40)
hist(scale2(exp(y),10,1,yj=T),breaks = 40)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.