R/data_scaling_fn.R

Defines functions data_scaling

#' Scaling Function for EWSNet
#'
#' Scales a numeric vector to be in the range 1-2.
#'
#' @param x A numeric vector to be scaled.
#'
#' @returns A scaled numeric vector where the minimum value is 1 and the maximum is 2.
#'
#' @keywords internal
#' @noRd

data_scaling <- function(x){

  x_min <- min(x,na.rm = T)
  s <- (x-x_min)/(max(x,na.rm = T)-x_min)

  return(s+1)

}
duncanobrien/EWSmethods documentation built on Aug. 28, 2024, 4:25 a.m.