check.integer: Check if a number is integer

Description Usage Arguments Details Value Author(s) Source Examples

View source: R/install.R

Description

Returns TRUE/FALSE on whether a number is integer or not.

Usage

1

Arguments

N

A number (if a vector is supplied only the first element is checked - without warning)

Details

Surprising as it may be, R doesn't come with a handy function to check if the number is integer. This function does just this.

Value

TRUE/FALSE on whether a number is integer or not.

Author(s)

VitoshKa

Source

http://stackoverflow.com/questions/3476782/how-to-check-if-the-number-is-integer

Examples

1
2
3
4
5
6
7
8
9
check.integer <- installr:::check.integer
check.integer(4) # TRUE
check.integer(3243) #TRUE
check.integer(3243.34) #FALSE
check.integer("sdfds") #FALSE
check.integer(1e4) #TRUE
check.integer(1e6) #TRUE
check.integer(1e600) #FALSE - the function is having a hardtime with Inf...
rm(check.integer)

installr documentation built on Oct. 7, 2018, 1:08 a.m.