Skip to contents

Similar to `is_positive_integer()` but without the constraint that the underlying data type is actually integer. Useful if the numbers are stored as `numeric` but you want to check that they are whole.

Usage

is_whole_number(x)

Arguments

x

A vector

Value

TRUE if all elements are whole numbers (NA ignored)

Details

`NA`s are ignored.

Examples

is_whole_number(c(2.0, 4.0)) # TRUE
#> [1] TRUE
is_whole_number(c(-1.4)) # FALSE
#> [1] FALSE