R/normdat.R

"normdat" <-
  function(mat) {
    if (!is.matrix(mat)) {
      mat <- as.matrix(mat)
    }
    for (i in 1:ncol(mat)) {
      if (max(abs(mat[, i])) == 0) {
        mat[, i] <- 1
      } else {
        mat[, i] <- mat[, i] / max(abs(mat[, i]))
      }
    }
    mat
  }

Try the TIMP package in your browser

Any scripts or data that you put into this service are public.

TIMP documentation built on Dec. 28, 2022, 3:06 a.m.