is_wholenumber {ds4psy}R Documentation

Test for whole numbers (i.e., integers).

Description

is_wholenumber tests if x contains only integer numbers.

Usage

is_wholenumber(x, tol = .Machine$double.eps^0.5)

Arguments

x

Number(s) to test (required, accepts numeric vectors).

tol

Numeric tolerance value. Default: tol = .Machine$double.eps^0.5 (see ?.Machine for details).

Details

is_wholenumber does what the base R function is.integer is not designed to do:

See the documentation of is.integer for definition and details.

See Also

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()

Examples

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) 


[Package ds4psy version 1.0.0 Index]