Learn R Programming

scales (version 1.2.1)

rescale_mid: Rescale vector to have specified minimum, midpoint, and maximum

Description

Rescale vector to have specified minimum, midpoint, and maximum

Usage

rescale_mid(x, to, from, mid, ...)

# S3 method for numeric rescale_mid(x, to = c(0, 1), from = range(x, na.rm = TRUE), mid = 0, ...)

# S3 method for logical rescale_mid(x, to = c(0, 1), from = range(x, na.rm = TRUE), mid = 0, ...)

# S3 method for dist rescale_mid(x, to = c(0, 1), from = range(x, na.rm = TRUE), mid = 0, ...)

# S3 method for POSIXt rescale_mid(x, to = c(0, 1), from = range(x, na.rm = TRUE), mid, ...)

# S3 method for Date rescale_mid(x, to = c(0, 1), from = range(x, na.rm = TRUE), mid, ...)

# S3 method for integer64 rescale_mid(x, to = c(0, 1), from = range(x, na.rm = TRUE), mid = 0, ...)

Arguments

x

vector of values to manipulate.

to

output range (numeric vector of length two)

from

input range (vector of length two). If not given, is calculated from the range of x

mid

mid-point of input range

...

other arguments passed on to methods

Examples

Run this code
rescale_mid(1:100, mid = 50.5)
rescale_mid(runif(50), mid = 0.5)
rescale_mid(1)

Run the code above in your browser using DataLab