View source: R/lineartransform.R
lineartransform | R Documentation |
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.
lineartransform(futureRange = c(1, 5), vec = NULL, digits = NULL)
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. |
a vector with the linearly transformed new values, rounded to how many digits the user has set the function argument 'digits'.
Marcel Miché
lm; linear model command from the stats package
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.