check_integer: Check if a number is an integer

Description Usage Arguments Value Author(s) See Also Examples

Description

Uses grep to test if the object contains only numbers.

Usage

1

Arguments

n

An object to test.

Value

Returns a logical (TRUE or FALSE).

Author(s)

Originally from http://stackoverflow.com/a/3937820

See Also

grep, format.

Examples

1
2
3
4
5
check_integer(1) # True
check_integer(1.2) # False
check_integer(1e10) # True
check_integer(1e-10) # False
check_integer('cheese') # Unsurprisingly: False

dpritchard/dgmisc documentation built on May 15, 2019, 1:50 p.m.