scale_range: Rescale

Description Usage Arguments Details Value Examples

View source: R/01-basic.R

Description

Maturing lifecycle

Usage

1
2
3
4
5
scale_range(x, to, na.rm = getOption("transx.na.rm"))

scale_minmax(x, na.rm = getOption("transx.na.rm"))

scale_unit_len(x, na.rm = getOption("transx.na.rm"))

Arguments

x

[univariate vector]

Univariate vector, numeric or ts object with only one dimension.

to

[numeric(2): NULL]

Values that will determine the output range.

na.rm

[logical(1): getOption("transx.na.rm")]

A value indicating whether NA values should be stripped before the computation proceeds.

Details

To rescale a range between an arbitrary set of values [a, b], the formula becomes:

Value

Returns a vector with the same class and attributes as the input vector.

Examples

1
2
3
x <- c(10,5,1,-2)
scale_range(x, c(-1, 2))
scale_minmax(x)

kvasilopoulos/transx documentation built on Jan. 26, 2021, 6:14 p.m.