Maturing lifecycle

Convert number of standard deviations by which the value of a raw score is above or below the mean value of what is being observed or measured.

std_mean(x, na.rm = getOption("transx.na.rm"))

std_median(x, na.rm = getOption("transx.na.rm"))

Arguments

x

[univariate vector]

Univariate vector, numeric or ts object with only one dimension.

na.rm

[logical(1): getOption("transx.na.rm")]

A value indicating whether NA values should be stripped before the computation proceeds.

Value

Returns a vector with the same class and attributes as the input vector.

Examples

x <- c(10,2,5,3) std_mean(x)
#> [1] 1.4048787 -0.8429272 0.0000000 -0.5619515
scale(x)
#> [,1] #> [1,] 1.4048787 #> [2,] -0.8429272 #> [3,] 0.0000000 #> [4,] -0.5619515 #> attr(,"scaled:center") #> [1] 5 #> attr(,"scaled:scale") #> [1] 3.559026
std_median(x)
#> [1] 2.6979630 -0.8993210 0.4496605 -0.4496605