Perform a standard deviational stretch on any numeric coercible to a vector object. Z-scores are first calculated, and values that exceed the threshold are reassigned the theshold value

rescaleSD(x, stdev = 2)

Arguments

x

The input value, vector, list, or anything coercible to a vector with unlist. Values must be numeric

stdev

The threshold number of standard deviations. Input values n whith a z score whose absolute value is beyond this threshold will be reassigned x[n] <- stdev * z/abs(z)

Value

A numeric vector with threshold-limited z-scores

Examples

# Create a vector
x <- rnorm(10, mean = 10, sd = 10)

y <- rescaleSD(x, stdev = 1)