linearMap {Smisc} | R Documentation |
Linear mapping of a numeric vector or scalar from one closed interval to another
linearMap(x, D = range(x), R = c(0, 1))
x |
a numeric vector |
D |
a vector with 2 elements, the first being the lower endpoint of
the domain, the upper being the upper endpoint of the domain. Note
|
R |
a vector with 2 elements indicating the range of the linear
mapping. |
The mapping is f : D --> R, where f(D[1]) = R[1] and f(D[2]) = R[2].
The linear mapping of x
from D
to R
Landon Sego
x <- seq(0, 1, length = 5) # An increasing linear map linearMap(x, R = c(4, 7)) # A decreasing map linearMap(x, R = c(7, 4)) # A shift linearMap(x, R = c(-1, 0)) # The identity map: y <- linearMap(x, D = c(0, 1), R = c(0, 1)) identical(y, x)