Learn R Programming

installr (version 0.22.0)

check.integer: Check if a number is integer

Description

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

Usage

check.integer(N)

Arguments

N

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

Value

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

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.

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab