R/getDigits.R

Defines functions getDigits

#' @title getDigits
#' @description extracts number of digits
#' @author E. F. Haghish
#' @return integer
#' @keywords Internal
#' @noRd

getDigits <- function(x) {
  if (!is.null(x)) {
    result <- floor(log10(abs(x)))
    result[!is.finite(result)] = 0
    return(abs(result))
  }
  else return(0)
}

Try the mlim package in your browser

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

mlim documentation built on Dec. 28, 2022, 2:33 a.m.