Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

is.wholenumber

Check for whole number values


Description

Unlike is.integer(), which checks the type of argument is integer, this function checks whether the value of the argument is an integer (within a specified tolerance).

Usage

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

Arguments

x

a vector

tol

a numeric tolerance

Details

This function is borrowed from the examples for is.integer()

Value

a logical vector indicating whether x has a whole number value

Examples

is.wholenumber(1)
all(is.wholenumber(rbinom(100,10,.5)))
is.wholenumber((1:10)/2)

mosaic

Project MOSAIC Statistics and Mathematics Teaching Utilities

v1.8.3
GPL (>= 2)
Authors
Randall Pruim [aut, cre], Daniel T. Kaplan [aut], Nicholas J. Horton [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.