Aliases: integer as.integer is.integer
Keywords: classes
### ** Examples ## as.integer() truncates: x <- pi * c(-1:1, 10) as.integer(x)
[1] -3 0 3 31
is.integer(1) # is FALSE !
[1] FALSE
is.wholenumber <- function(x, tol = .Machine$double.eps^0.5) abs(x - round(x)) < tol is.wholenumber(1) # is TRUE
[1] TRUE
(x <- seq(1, 5, by = 0.5) )
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
is.wholenumber( x ) #--> TRUE FALSE TRUE ...
[1] TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE