Description Usage Arguments Value Examples
is_wholenumber()
uses base::round()
to test whether x
is a whole number,
it will therefore issue an error if x
is not of mode numeric.
If used in base::stopifnot()
for example, this won't be a problem but it may be in conditionals.
is_scalar_wholenumber()
comes with the additional argument check_numeric
to check whether x
is a numeric before checking it is a whole number.
1 2 3 | is_wholenumber(x, tol = .Machine$double.eps^0.5)
is_scalar_wholenumber(x, check_numeric = TRUE, ...)
|
x |
Object to be tested |
tol |
Tolerance |
check_numeric |
Whether to check whether |
... |
Arguments to pass to |
Logical
1 2 3 4 5 | is_wholenumber(1) # TRUE
is_wholenumber(1.0) # TRUE
is_wholenumber(1.1) # FALSE
is_scalar_wholenumber(1) # TRUE
is_scalar_wholenumber(c(1, 2)) # FALSE
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.