Learn R Programming

thisutils (version 0.0.7)

rescale: Rescale numeric vector

Description

Rescale numeric vector

Usage

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

Value

A numeric vector with rescaled values.

Arguments

x

A numeric vector.

from

The range of the original data.

to

The range of the rescaled data.

Examples

Run this code
x <- rnorm(10)
rescale(x)
rescale(x, from = c(0, 1))
rescale(x, to = c(0, 2))

Run the code above in your browser using DataLab