R/norm01.R

Defines functions norm01

Documented in norm01

#' Normalize a vector to [0,1]
#'
#' @param x a vector to normalize
#'
#' @return (x-min(x))/(max(x)-min(x))
#' @export
#'
#' @examples
#' x <- 1:10
#' norm01(x)
norm01 <- function(x) {
    (x - min(x)) / (max(x) - min(x))
}
colinbousige/tutor documentation built on Jan. 29, 2023, 7:35 p.m.