Learn R Programming

tokenbrowser (version 0.1.6)

rescale_var: Rescale a numeric variable

Description

Rescale a numeric variable

Usage

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

Value

a numeric vector

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.

Examples

Run this code
rescale_var(1:10)
rescale_var(1:10, new_min = -1, new_max = 1)

Run the code above in your browser using DataLab