```
## as.integer() truncates:
x <- pi * c(-1:1, 10)
as.integer(x)
is.integer(1) # is FALSE !
is.wholenumber <-
function(x, tol = .Machine$double.eps^0.5) abs(x - round(x)) < tol
is.wholenumber(1) # is TRUE
(x <- seq(1, 5, by = 0.5) )
is.wholenumber( x ) #--> TRUE FALSE TRUE ...
```

Run the code above in your browser using DataCamp Workspace