checkIntegerish {checkmate} | R Documentation |
An integerish value is defined as value safely convertible to integer. This includes integers and numeric values which are close to an integer w.r.t. a numeric tolerance.
checkIntegerish(x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, null.ok = FALSE) check_integerish(x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, null.ok = FALSE) assertIntegerish(x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, null.ok = FALSE, coerce = FALSE, .var.name = vname(x), add = NULL) assert_integerish(x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, null.ok = FALSE, coerce = FALSE, .var.name = vname(x), add = NULL) testIntegerish(x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, null.ok = FALSE) test_integerish(x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, null.ok = FALSE) expect_integerish(x, tol = sqrt(.Machine$double.eps), lower = -Inf, upper = Inf, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, sorted = FALSE, names = NULL, null.ok = FALSE, info = NULL, label = vname(x))
x |
[any] |
tol |
[ |
lower |
[ |
upper |
[ |
any.missing |
[ |
all.missing |
[ |
len |
[ |
min.len |
[ |
max.len |
[ |
unique |
[ |
sorted |
[ |
names |
[ |
null.ok |
[ |
coerce |
[ |
.var.name |
[ |
add |
[ |
info |
[character(1)] |
label |
[ |
This function does not distinguish between
NA
, NA_integer_
, NA_real_
, NA_complex_
NA_character_
and NaN
.
Depending on the function prefix:
If the check is successful, the functions
assertIntegerish
/assert_integerish
return
x
invisibly, whereas
checkIntegerish
/check_integerish
and
testIntegerish
/test_integerish
return
TRUE
.
If the check is not successful,
assertIntegerish
/assert_integerish
throws an error message,
testIntegerish
/test_integerish
returns FALSE
,
and checkIntegerish
returns a string with the error message.
The function expect_integerish
always returns an
expectation
.
To convert from integerish to integer, use asInteger
.
Other basetypes: checkArray
,
checkAtomicVector
,
checkAtomic
, checkCharacter
,
checkComplex
, checkDataFrame
,
checkDate
, checkDouble
,
checkEnvironment
,
checkFactor
, checkFormula
,
checkFunction
, checkInteger
,
checkList
, checkLogical
,
checkMatrix
, checkNull
,
checkNumeric
, checkPOSIXct
,
checkRaw
, checkVector
testIntegerish(1L) testIntegerish(1.) testIntegerish(1:2, lower = 1L, upper = 2L, any.missing = FALSE)