Tests if a number or vector is a whole number

is.wholenumber(x, tol = .Machine$double.eps^0.5)

Arguments

x

a number or vector or matrix

tol

double tolerance

Value

a logical of the same format as x

Examples

is.wholenumber(-5)
#> [1] TRUE
is.wholenumber(10)
#> [1] TRUE
is.wholenumber(2.5)
#> [1] FALSE
is.wholenumber(matrix(1:9, nrow=3))
#>      [,1] [,2] [,3]
#> [1,] TRUE TRUE TRUE
#> [2,] TRUE TRUE TRUE
#> [3,] TRUE TRUE TRUE