is_int_val: Test if a number is integer value

Description Usage Arguments Details Value See Also Examples

Description

Tests if the supplied number is an integer value (or could be coerced to one).

Usage

1
is_int_val(num, tol = .Machine$double.eps^0.5)

Arguments

num

numeric: the number to be tested for whether it is an integer value.

tol

numeric: a small value to be used as the mathematical tolerance when assessing whether the number is an integer.
The default of .Machine$double.eps ^ 0.5 is approximately equal to 1.5e-08 on a 64-bit machine.

Details

is_int_val differs from is.integer in that is.integer tests for objects of type "integer", not for whether the numbers themselves are integers.

For example, the following two calls return FALSE: is.integer(5.0) or is.integer(5), though this call returns TRUE: is_int_val(5.0).

Note that both is.integer(5L) and is_int_val(5L) return TRUE.

Value

logical: TRUE if the supplied number is an integer value, FALSE otherwise.

See Also

is.integer

Examples

1
2
3
4
5
6
7
is_int_val(100)     # => TRUE
is_int_val(100.0)   # => TRUE
is_int_val(100L)    # => TRUE

is_int_val(100.001) # => FALSE

is_int_val(TRUE)    # => TRUE

toniprice/jutebag documentation built on May 12, 2019, 4:39 a.m.