Getting around the problem with is.integer is.integer(1) [1] FALSE A new function: is.wholenumber <- function(x, tol = .Machine$double.eps^0.5) abs(x - round(x)) < tol Example: is.wholenumber(1) [1] TRUE