R/is.wholenumber.R

Defines functions is.wholenumber

is.wholenumber <- function(x, tol = .Machine$double.eps^0.5) {
  warn <- getOption("warn"); options(warn = -1)

  x <- try(as.numeric(x))

  options(warn = warn)

  if (any(is.na(x))) {
    FALSE
  }
  else {
    is.numeric(x) && all(abs(x - round(x)) < tol)
  }
} ## is.wholenumber

Try the rebmix package in your browser

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

rebmix documentation built on July 26, 2023, 5:32 p.m.