Learn R Programming

rccmisc (version 0.3.7)

is.wholenumber: Test if a numeric vector consists of whole numbers

Description

Function borrowed from the examle section for integer.

Usage

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

Arguments

x
a numeric vector
tol
How much is x allowed to deviate from round(x) to be a whole number.

Value

Logical vector with same length as x.

Examples

Run this code
is.wholenumber(1) # is TRUE
(x <- seq(1, 5, by = 0.5) )
is.wholenumber( x ) #-->  TRUE FALSE TRUE ...

Run the code above in your browser using DataLab