# IsWhole: Check a Vector For Being Numeric, Zero Or a Whole Number In DescTools: Tools for Descriptive Statistics

## Description

Test if x contains only integer numbers, or if is numeric or if it is zero.

## Usage

 ```1 2 3``` ```IsWhole(x, all = FALSE, tol = sqrt(.Machine\$double.eps), na.rm = FALSE) IsZero(x, tol = sqrt(.Machine\$double.eps), na.rm = FALSE) IsNumeric(x, length.arg = Inf, integer.valued = FALSE, positive = FALSE, na.rm = FALSE) ```

## Arguments

 `x` a (non-empty) numeric vector of data values. `all` logical, specifying if the whole vector should be checked. If set to `TRUE` the function will return the result of `all(IsWhole(x))`. `tol` tolerance to be used `length.arg` integer, the length of the vector to be checked for. `integer.valued` logical, should x be checked as integer? `positive` logical, is x supposed to be positive? `na.rm` logical, indicating whether `NA` values should be stripped before the computation proceeds. Defaults to `FALSE`.

## Details

IsWhole is the suggested solution for checking for an integer value, as `is.integer` tests for `class(x) == "integer"` and does NOT test whether x (which might be of class "numeric") contains only integer numbers. (Why not simply implement it in base?)

IsZero tests float numeric values for being zero.

IsNumeric combines a test for numeric and integers.

## Value

logical vector of the same dimension as x.

## Author(s)

R-Core, Andri Signorell <andri@signorell.net>, Thomas W. Yee

`is.integer`
 ``` 1 2 3 4 5 6 7 8 9 10``` ```(x <- seq(1,5, by=0.5)) IsWhole( x ) #--> \code{TRUE} \code{FALSE} \code{TRUE} ... # ... These are people who live in ignorance of the Floating Point Gods. # These pagans expect ... (Burns, 2011)" the following to be TRUE: (.1 - .3 / 3) == 0 # they might be helped by IsZero(.1 - .3 / 3) ```