| is_integer {riskyr} | R Documentation |
Test for inters (i.e., whole numbers).
Description
is_integer tests if x contains only integer numbers.
Usage
is_integer(x, tol = .Machine$double.eps^0.5)
Arguments
x |
Number(s) to test (required, accepts numeric vectors). |
tol |
Numeric tolerance value.
Default: |
Details
Thus, is_integer does what the base R function is.integer is not designed to do:
-
is_integer()returns TRUE or FALSE depending on whether its numeric argumentxis an integer value (i.e., a "whole" number). -
is.integer()returns TRUE or FALSE depending on whether its argument is of type "integer", and FALSE if its argument is a factor.
See the documentation of is.integer for definition and details.
See Also
is.integer function of the R base package.
Other verification functions:
is_complement(),
is_extreme_prob_set(),
is_freq(),
is_matrix(),
is_perc(),
is_prob(),
is_suff_prob_set(),
is_valid_prob_pair(),
is_valid_prob_set(),
is_valid_prob_triple()
Examples
is_integer(2) # TRUE
is_integer(2/1) # TRUE
is_integer(2/3) # FALSE
x <- seq(1, 2, by = 0.5)
is_integer(x)
# Note contrast to base R:
is.integer(2/1) # FALSE!
# Compare:
is.integer(1 + 2)
is_integer(1 + 2)