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

Description Usage Arguments Value Examples

View source: R/is.wholenumber.R

Description

Function borrowed from the examle section for integer.

Usage

1
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

1
2
3
is.wholenumber(1) # is TRUE
(x <- seq(1, 5, by = 0.5) )
is.wholenumber( x ) #-->  TRUE FALSE TRUE ...

Example output

[1] TRUE
[1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
[1] FALSE

rccmisc documentation built on May 2, 2019, 2:48 p.m.