View source: R/bruceR-stats_1_basic.R
RESCALE | R Documentation |
Rescale a variable (e.g., from 5-point to 7-point).
RESCALE(var, from = range(var, na.rm = T), to)
var |
Variable (numeric). |
from |
Numeric vector, the range of old scale (e.g., |
to |
Numeric vector, the range of new scale (e.g., |
A vector of rescaled variable.
d = data.table(var=rep(1:5, 2))
added(d, {
var1 = RESCALE(var, to=1:7)
var2 = RESCALE(var, from=1:5, to=1:7)
})
d # var1 is equal to var2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.