Skip to contents

Check for valid input of either explicit (e.g. 1L) and/or implict (e.g. 1) integer.

Usage

isIntegerish(x, infiniteOk = TRUE, naOk = FALSE)

allAreIntegerish(x)

isInt(x, nullOk = FALSE)

Arguments

x

Object.

infiniteOk

logical(1). Allow infinite values (Inf or -Inf) to pass.

naOk

logical(1). Allow NA values to pass.

nullOk

logical(1). If set to TRUE, x may also be NULL.

Value

TRUE on success; FALSE on failure, with cause set.

Functions

  • isIntegerish(): Vectorized.

  • allAreIntegerish(): Scalar.

  • isInt(): Scalar.

Note

Updated 2023-09-29.

See also

Examples

## TRUE ====
isIntegerish(seq_len(2L))
#> [1] TRUE TRUE
isIntegerish(c(1, 2))
#> [1] TRUE TRUE
isIntegerish(S4Vectors::Rle(c(1, 2)))
#> [1] TRUE TRUE

## FALSE ====
isIntegerish(0.1)
#> [1] FALSE