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

Name of object defined in x. 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 set.

Functions

  • isIntegerish: Vectorized.

  • isInt: Scalar.

Note

Updated 2019-10-09.

See also

Examples

## TRUE ==== isIntegerish(seq_len(2L))
#> 1 2 #> TRUE TRUE
isIntegerish(c(1, 2))
#> 1.000000000000000e+00 2.000000000000000e+00 #> TRUE TRUE
## FALSE ==== isIntegerish(0.1)
#> [1] FALSE #> Cause: 1 failure #> pos value cause #> 1 1 1.000000000000000e-01 not integer