DescTools (version 0.99.8.1)

IsWhole: Is x a Whole Number?

Description

Test if x contains integer numbers.

Usage

IsWhole(x, tol = .Machine$double.eps^0.5, na.rm = FALSE)

Arguments

x
a (non-empty) numeric vector of data values.
tol
tolerance to be used
na.rm
logical, indicating whether NA values should be stripped before the computation proceeds. Defaults to FALSE.

Value

  • logical vector of the same dimension as x.

Details

This is the suggested solution for doing the job, as is.integer tests for (class(x) == "integer") and does not test if x contains integer numbers. (Why not simply implement it in base?)

See Also

is.integer

Examples

Run this code
(x <- seq(1,5, by=0.5))
IsWhole( x ) #-->  TRUE FALSE TRUE ...

Run the code above in your browser using DataCamp Workspace