rescale: Rescale numeric vector to have specified minimum and maximum.

rescaleR Documentation

Rescale numeric vector to have specified minimum and maximum.

Description

Rescale numeric vector to have specified minimum and maximum, but allow for hard boundaries. It is a slightly modified version of scales::rescale, incorporating scales::zero_range, both by Hadley Wickham used under the conditions of the MIT license.

Usage

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

Arguments

x

values to rescale

to

range to scale to

from

range of values the x could have been

hard_bounds

If TRUE, all values will be forced into the range of to.


grunwaldlab/metacoder documentation built on Feb. 22, 2024, 3:47 a.m.