scale2: Scale

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Returns scores in x after rescaling

Usage

1
scale2(x, center = TRUE, scale = TRUE)

Arguments

x

A numeric vector, matrix or data.frame

center

A logical indicating whether the scores in the columns in x should have their column means subtracted

scale

A logical indicating where the scores in the columns in x should be divided by their column standard deviations

Details

The built-in R function scale uses the sample standard deviation when its scale option is set to TRUE. This function uses the population standard deviation instead.

Value

Returns a variable with dimensions equal to that has been scaled according to the arguments used

Author(s)

Ryne A. Sherman

See Also

scale

Examples

1
2
3
scale(1:5)
scale2(1:5)
	

Example output

Loading required package: psych
Loading required package: abind
Loading required package: foreach
           [,1]
[1,] -1.2649111
[2,] -0.6324555
[3,]  0.0000000
[4,]  0.6324555
[5,]  1.2649111
attr(,"scaled:center")
[1] 3
attr(,"scaled:scale")
[1] 1.581139
              x
[1,] -1.4142136
[2,] -0.7071068
[3,]  0.0000000
[4,]  0.7071068
[5,]  1.4142136

multicon documentation built on May 2, 2019, 3:18 a.m.