# linearMap: Linear mapping of a numeric vector or scalar

Description Usage Arguments Details Value Author(s) Examples

### Description

Linear mapping of a numeric vector or scalar from one contiguous interval to another

### Usage

 1 linearMap(x, D = range(x), R = c(0, 1)) 

### Arguments

 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[1] must be less than R[2]. R a vector with 2 elements indicating the range of the linear mapping. R[1] is mapped to D[1], and R[2] is mapped to D[2].

### Details

The mapping is f : D \rightarrow R, where f(D[1]) = R[1] and f(D[2]) = R[2].

### Value

The linear mapping of x from D to R

Landon Sego

### Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 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) 

Search within the Smisc package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.