# stretchMinMax: Rescale values In adamlilith/omnibus: Ease-of-use tools

## Description

This function rescales a vector of numeric values to an arbitrary range. Optionally, after the stretch values equal to the lowest value can be "nudged" slightly higher to half the minimum value across the rescaled vector of values > 0.

## Usage

 ```1 2``` ```stretchMinMax(x, lower = 0, upper = 1, nudgeUp = FALSE, nudgeDown = FALSE, na.rm = FALSE) ```

## Arguments

 `x` Numeric list. `lower` Numeric, low end of range to which to stretch. `upper` Numeric, high end of range to which to stretch. `na.rm` Logical, if `FALSE` (default) then if any values of `x` are `NA` then the returned value will be `NA`. If `TRUE` then `NA`'s are ignored in calculation. `nudge` Logical, if `FALSE` (default) then do nothing. If `TRUE` then *after* rescaling to [0, 1], a small value will be added to all values of `x` equal to 0. This value is equal to `0.5 * min(x[x > 0])`.

## Value

Numeric value.

`scale`
 ``` 1 2 3 4 5 6 7 8 9 10``` ```x <- 1:10 stretchMinMax(x) stretchMinMax(x, lower=2, upper=5) stretchMinMax(x, nudgeUp=TRUE) stretchMinMax(x, lower=2, upper=5, nudgeUp=TRUE) stretchMinMax(x, nudgeDown=TRUE) stretchMinMax(x, lower=2, upper=5, nudgeUp=TRUE, nudgeDown=TRUE) x <- c(1:5, NA) stretchMinMax(x) stretchMinMax(x, na.rm=TRUE) ```