rescale: Scale a series between two values

Description Usage Arguments Examples

Description

rescale is a utility to resize the range of values while keeping the original spacing between values.

Usage

1
rescale(x, to = c(0, 1), from = range(x, na.rm = TRUE))

Arguments

x

Numeric vector.

to

Output range.

from

Input range to be rescaled to to. Default is the range of x.

Examples

1
2
3
4
x <- -10:10
rescale(x)
rescale(x, to = c(-1, 3))
rescale(x, from = c(5, max(x)), to = c(0, 10))

SESman/rbl documentation built on May 9, 2019, 11:10 a.m.