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

isIntegerish(x, .xname = getNameInParent(x))

isInt(x, nullOK = FALSE)

Arguments

x

Object.

.xname

Not intended to be used directly.

nullOK

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

Value

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

Functions

  • isIntegerish: Vectorized.

  • isInt: Scalar.

See also

Examples

## TRUE ==== isIntegerish(seq_len(2L))
#> [1] TRUE TRUE
isIntegerish(c(1, 2))
#> [1] TRUE TRUE
## FALSE ==== isIntegerish(0.1)
#> [1] FALSE #> Cause of failure: #> not integer