scaleRng | R Documentation |
Transforms numeric data to a specified range.
scaleRng(x, Min = 0, Max = 1, x.range = range(x, na.rm = TRUE)) IscaleRng(x, Min, Max, x.range)
x |
any numeric vector. Missing values are permitted and result in missing values in the corresponding output. |
Min |
the minimum of the output range. |
Max |
the maximum of the output range. |
x.range |
the input range to map to the output range. The default range is
computed from the range of |
The function scaleRng
maps the minimum of x.range
to Min
and the maximum of x.range
to Max
and uses linear interpolation
for other values in x
.
A numeric vector scaled to the specified range.
Some applications recommend or require data scaled to a consistent range.
The function scaleRng
will do that and can be used to back-transform
the data.
## simple case with back-transform x.tmp <- print(scaleRng(c(1.2, 2.3, 3.4, 5.6))) IscaleRng(x.tmp) ## now set the expected ranges x.tmp <- print(scaleRng(c(1.2, 2.3, 3.4, 5.6), x.range=c(1, 6))) IscaleRng(x.tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.