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 utility functions: num_as_char(), num_as_ordinal()
num_as_char()
num_as_ordinal()
# NOT RUN { 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