rangeRescale: rangeRescale this function rescales a numeric vector to a new...

View source: R/generic_utilities.R

rangeRescaleR Documentation

rangeRescale this function rescales a numeric vector to a new range through linear interpolation

Description

rangeRescale this function rescales a numeric vector to a new range through linear interpolation

Usage

rangeRescale(
  x,
  newMin,
  newMax,
  oldMin = min(x, na.rm = T),
  oldMax = max(x, na.rm = T),
  pres.signs = FALSE
)

Arguments

x
newMin, newMax

Any two points (typically min and max) of the new scale

oldMin, oldMax

The corresponding two points of the original scale. If oldMin or oldMax are missing the min or max of x are used instead

pres.sign

logical. if TRUE the signs of the original data are preserved. newMin and newMax must be opposites (e.g. -1,1)


kleinbub/rIP documentation built on Dec. 21, 2024, 9:15 a.m.