powered by
is_wholenumber tests if x contains only integer numbers.
is_wholenumber
x
is_wholenumber(x, tol = .Machine$double.eps^0.5)
Number(s) to test (required, accepts numeric vectors).
Numeric tolerance value. Default: tol = .Machine$double.eps^0.5 (see ?.Machine for details).
tol = .Machine$double.eps^0.5
?.Machine
is_wholenumber does what the base R function is.integer is not designed to do:
is.integer
is_wholenumber() returns TRUE or FALSE depending on whether its numeric argument x is an integer value (i.e., a "whole" number).
is_wholenumber()
is.integer() returns TRUE or FALSE depending on whether its argument is of integer type, and FALSE if its argument is a factor.
is.integer()
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()
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_vect()
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)
Run the code above in your browser using DataLab