Checks that the (probably floating point) input is a whole number.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
assert_all_numbers_are_whole_numbers(x, tol = 100 * .Machine$double.eps,
na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_any_numbers_are_whole_numbers(x, tol = 100 * .Machine$double.eps,
na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_all_are_whole_numbers(x, tol = 100 * .Machine$double.eps,
na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_any_are_whole_numbers(x, tol = 100 * .Machine$double.eps,
na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
is_whole_number(x, tol = 100 * .Machine$double.eps,
.xname = get_name_in_parent(x))
``` |

`x` |
Input to check. |

`tol` |
Differences smaller than |

`na_ignore` |
A logical value. If |

`severity` |
How severe should the consequences of the assertion be?
Either |

`.xname` |
Not intended to be used directly. |

`TRUE`

if the input is a whole number.

The term whole number is used to distinguish from integer in
that the input `x`

need not have type `integer`

. In fact
it is expected that `x`

will be `numeric`

.

1 2 3 4 5 6 | ```
# 1, plus or minus a very small number
x <- 1 + c(0, .Machine$double.eps, -.Machine$double.neg.eps)
# By default, you get a bit of tolerance for rounding errors
is_whole_number(x)
# Set the tolerance to zero for exact matching.
is_whole_number(x, tol = 0)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.