IsWhole(x, tol = .Machine$double.eps^0.5, na.rm = FALSE)
IsZero(x, tol = .Machine$double.eps^0.5, na.rm = FALSE)
IsNumeric(x, length.arg = Inf, integer.valued = FALSE, positive = FALSE, na.rm = FALSE)
is.integer
tests for class(x) == "integer"
and does NOT test whether x (which might be of class "numeric") contains only integer numbers.
(Why not simply implement it in is.integer
(x <- seq(1,5, by=0.5))
IsWhole( x ) #--> TRUE FALSE TRUE ...
# ... These are people who live in ignorance of the Floating Point Gods.
# These pagans expect ... (Burns, 2011)" the following to be TRUE:
(.1 - .3 / 3) == 0
# they might be helped by
IsZero(.1 - .3 / 3)
Run the code above in your browser using DataLab