Is object a vector of whole numerics
is_whole_numeric.RdReturns TRUE if x is an integer vector, or a double vector whose values are exactly equal to their truncated form.
See is_whole_number() to test for whole numbers within a chosen tolerance.
See base::is.integer() to test for integer storage type.
Details
Infand-Infin double storage returnTRUEbecauseInf == trunc(Inf).NAandNaNreturnFALSE.Zero-length input and
NULLreturnFALSE.
Examples
#----------------------------------------------------------------------------
# is_whole_numeric() examples
#----------------------------------------------------------------------------
library(bkbase)
# TRUE
is_whole_numeric(1L)
#> [1] TRUE
is_whole_numeric(1)
#> [1] TRUE
is_whole_numeric(9.0)
#> [1] TRUE
is_whole_numeric(1e100)
#> [1] TRUE
is_whole_numeric(Inf)
#> [1] TRUE
# FALSE
is_whole_numeric(1.00000001)
#> [1] FALSE
is_whole_numeric(sqrt(2)^2)
#> [1] FALSE
is_whole_numeric(1 + 2^-30)
#> [1] FALSE
# Missing values and zero-length
is_whole_numeric(NA_integer_) # FALSE
#> [1] FALSE
is_whole_numeric(NA_real_) # FALSE
#> [1] FALSE
is_whole_numeric(NaN) # FALSE
#> [1] FALSE
is_whole_numeric(numeric(0)) # FALSE
#> [1] FALSE
is_whole_numeric(NULL) # FALSE
#> [1] FALSE