is_wholenumber | R Documentation |
is_wholenumber
tests if x
contains only integer numbers.
is_wholenumber(x, tol = .Machine$double.eps^0.5)
x |
Number(s) to test (required, accepts numeric vectors). |
tol |
Numeric tolerance value.
Default: |
is_wholenumber
does what the base R function is.integer
is not designed to do:
is_wholenumber()
returns TRUE or FALSE depending on whether its numeric argument x
is an integer value (i.e., a "whole" number).
is.integer()
returns TRUE or FALSE depending on whether its argument is of integer type, and FALSE if its argument is a factor.
See the documentation of is.integer
for definition and details.
is.integer
function of the R base package.
Other numeric functions:
base2dec()
,
base_digits
,
dec2base()
,
is_equal()
,
num_as_char()
,
num_as_ordinal()
,
num_equal()
Other utility functions:
base2dec()
,
base_digits
,
dec2base()
,
is_equal()
,
is_vect()
,
num_as_char()
,
num_as_ordinal()
,
num_equal()
is_wholenumber(1) # is TRUE
is_wholenumber(1/2) # is FALSE
x <- seq(1, 2, by = 0.5)
is_wholenumber(x)
# Compare:
is.integer(1+2)
is_wholenumber(1+2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.