lineartransform {correlatio}R Documentation

Linearly transform one scale into another scale.

Description

Transform the values of a variable into other values, by using the linear model. Additionally, select the number of decimal digits of the transformed values.

Usage

lineartransform(futureRange = c(1, 5), vec = NULL, digits = NULL)

Arguments

futureRange

Vector that shows the range of the new scale, e.g., c(1, 5).

vec

A vector which contains the values that shall be transformed to the new scale.

digits

A single integer that shows the number of digits, which the transformed values shall get rounded to.

Value

a vector with the linearly transformed new values, rounded to how many digits the user has set the function argument 'digits'.

Author(s)

Marcel Miché

References

lm; linear model command from the stats package

Examples

someValues <- stats::rnorm(n=10)
# Linearly transform to values between 1 and 5, rounded to zero digits.
lineartransform(futureRange = c(1, 5), vec = someValues, digits = 0)

[Package correlatio version 0.2.1 Index]