Learn R Programming

miscset (version 1.0.0)

scale0: Scale Numeric Values to Ranges

Description

Scale numeric values to a range from 0 to 1 with the function scale0 or to a chosen range with scaler.

Usage

scale0(x)
scaler(x, r = c(0, 1), b = range(x, na.rm = TRUE))

Arguments

x
Numeric vector to transform.
r
Numeric vector of length 2 for range to scale values of x to.
b
Numeric vector of length 2 to define the border of x to use as scaling minimum and maximum.

Examples

Run this code
#

scale0(0:10)
scale0(-1:3)
scale0(2:3)

scaler(0:10)
scaler(0:10, 1:2)
scaler(0:10, 1:2, c(0, 20))

#

Run the code above in your browser using DataLab