map01: Map Numeric Values to Range

View source: R/functions.R

map01R Documentation

Map Numeric Values to Range

Description

Rescale a numeric vector in such a way that all values lie within a specified range (per default 0 to 1).

Usage

map01(x, min = 0, max = 1, omin = min(x), omax = max(x), na.rm = FALSE)

Arguments

x

a numeric vector

min

a numeric vector of length one

max

a numeric vector of length one

omin

a numeric vector of length one

omax

a numeric vector of length one

na.rm

logical

Details

Maps the elements of a numeric vector to a specified range; default is 0 to 1.

Value

a numeric vector

Author(s)

Enrico Schumann

See Also

scale

Examples

map01(0:10)          ## 0, 0.1, 0.2 ... 1.0
map01(0:10, 0, 100)  ## 0, 10, 20 ... 100

enricoschumann/esutils documentation built on Feb. 2, 2024, 10:03 a.m.