is_whole_number: Check whether a numeric vector contains whole numbers.

View source: R/utils.R

is_whole_numberR Documentation

Check whether a numeric vector contains whole numbers.

Description

Because is.integer checks for the class, not whether the number is an integer in the mathematical sense. This code was copy-pasted from the is.integer docs.

Usage

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

Arguments

x

numeric vector

tol

tolerance (default: .Machine$double.eps^0.5)

Value

logical vector

Examples

## Not run: 
is_whole_number(c(1, 2, 3))
is.integer(c(1, 2, 3))
is_whole_number(c(1.0, 2.0, 3.0))
is_whole_number(1.2)

## End(Not run)

SchlossLab/mikropml documentation built on Aug. 24, 2023, 9:51 p.m.