rescale_var: Rescale a numeric variable

Description Usage Arguments Value Examples

View source: R/util.r

Description

Rescale a numeric variable

Usage

1
rescale_var(x, new_min = 0, new_max = 1, x_min = min(x), x_max = max(x))

Arguments

x

a numeric vector

new_min

The minimum value of the output

new_max

The maximum value of the output

x_min

The lowest possible value in x. By default this is the actual lowest value in x.

x_max

The highest possible value in x. By default this is the actual highest value in x.

Value

a numeric vector

Examples

1
2
rescale_var(1:10)
rescale_var(1:10, new_min = -1, new_max = 1)

tokenbrowser documentation built on Oct. 23, 2020, 6:54 p.m.