R/all_integers.R

Defines functions all_integers

# all_integers: robustly tests whether all elements of a vector are integers
# Date: October 04, 2026
all_integers <- function(x) {
  for (i in 1:length(x)) {
    if (is.na(x[i]) | is.list(x[i]) | length(x[i]) > 1 | !is.numeric(x[i])) {
      return(FALSE)
      }
    if (x[i]%%1!=0) {
      return(FALSE)
      }
    }
  return(TRUE)
  }

Try the conover.test package in your browser

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

conover.test documentation built on Oct. 5, 2026, 1:06 a.m.