
Scale a vector to the unit interval via a uniform transformation
Source:R/func_calibrate.R
scale_uniform.RdMaps x to \((x - \text{low}) / (\text{high} - \text{low})\).
Raises an error if x is outside [low, high]. Sets
NaN results to 0.
Lifecycle
Deprecated since spDBL 1.2.0 and will be removed in a future release.
The first call in a session warns; set
options(spDBL.warn_deprecated = FALSE) to silence it.
Examples
x <- c(2, 3.5, 5)
u <- scale_uniform(x, low = 2, high = 5)
u
#> [1] 0.0 0.5 1.0
all.equal(scale_back_uniform(u, low = 2, high = 5), x)
#> [1] TRUE