Skip to contents

Rescale data to have a new range.

Usage

format_scale(x, new_min = 0, new_max = 1)

Arguments

x

A numeric vector

new_min

A numeric single value (default = 0), that will be the new minimum value

new_max

A numeric single value (default = 1), that will be the new maximum value

Value

A numeric vector.

Examples


x <- seq(-3,3,l = 100)

range(x)
#> [1] -3  3

y <- format_scale(x)

range(y)
#> [1] 0 1

plot(x,y)