R/normalisation-fcns.R

Defines functions normalize.to.range

Documented in normalize.to.range

#' normalize.to.range
#'
#' Normalizes a numeric vector `x` to between a given range
#'
#' @export normalize.to.range
normalize.to.range <- function(x, range = c(0, 1)) {

  (range[2] - range[1]) /
    (max(x) - min(x)) *
    (x - max(x)) + range[2]

}
kmcd39/taux documentation built on Jan. 29, 2024, 11:45 p.m.