dot-is_whole: Check if a value is (close to) an Integer

Description Usage Arguments Value Examples

Description

Function is based on the code provided as an example for the function base::is.integer() (which does NOT do what you might expect).

Usage

1
.is_whole(.x, .tol = .Machine$double.eps^0.5)

Arguments

.x

Value or numerical vector to check

.tol

The tolerance. How close to an integer do you want to count as an integer? Default value is related to precision of floats, and thus depends on the computer and specific R installation. The default may be far too precise for many use cases, where you want to accept numbers somewhat close to an integer value.

Value

Boolean (TRUE or FALSE) vector, with length matching the length of .x.

Examples

1
2
3
.is_whole(4)
.is_whole(4.2)
.is.wholer(4.2, .tol = 0.25)

ccb60/SLRSIM documentation built on Jan. 21, 2022, 1:31 a.m.