is_wholenumber: Check if a Number is Whole

Description Usage Arguments Value Examples

View source: R/utils.R

Description

The built-in function is.integer() will check if a number is of the integer class. However, we would usually want a function that can check if a number is a whole number. It is also vectorised over the input.

Usage

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

Arguments

x

Number to check

tol

tolerance to check the values

Value

A logical vector the same length as x

Examples

1
2
3
4
5
is.integer(2)
is_wholenumber(2)

is.integer(seq(2, 3, 0.25))
is_wholenumber(seq(2, 3, 0.25))

rando documentation built on Feb. 16, 2021, 5:07 p.m.