Learn R Programming

assertive (version 0.2-6)

assert_is_an_integer: Is the input an integer?

Description

Checks to see if the input is an integer.

Usage

assert_is_an_integer(x)

assert_is_integer(x)

is_an_integer(x, .xname = get_name_in_parent(x))

is_integer(x, .xname = get_name_in_parent(x))

Arguments

x
Input to check.
.xname
Not intended to be used directly.

Value

  • is_integer wraps is.integer, providing more information on failure. is_an_integer returns TRUE if the input is an integer and scalar. The assert_* functions return nothing but throw an error if the corresponding is_* function returns FALSE.

See Also

is.integer and is_scalar.

Examples

Run this code
assert_is_integer(1:10)
assert_is_an_integer(99L)
#These examples should fail.
dont_stop(assert_is_integer(c(1, 2, 3)))
dont_stop(assert_is_an_integer(1:10))
dont_stop(assert_is_an_integer(integer()))

Run the code above in your browser using DataLab