checkInteger {checkmate} | R Documentation |
Check if an argument is vector of type integer
checkInteger(x, 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_integer(x, 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) assertInteger(x, 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, .var.name = vname(x), add = NULL) assert_integer(x, 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, .var.name = vname(x), add = NULL) testInteger(x, 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_integer(x, 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_integer(x, 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] |
lower |
[ |
upper |
[ |
any.missing |
[ |
all.missing |
[ |
len |
[ |
min.len |
[ |
max.len |
[ |
unique |
[ |
sorted |
[ |
names |
[ |
null.ok |
[ |
.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
assertInteger
/assert_integer
return
x
invisibly, whereas
checkInteger
/check_integer
and
testInteger
/test_integer
return
TRUE
.
If the check is not successful,
assertInteger
/assert_integer
throws an error message,
testInteger
/test_integer
returns FALSE
,
and checkInteger
returns a string with the error message.
The function expect_integer
always returns an
expectation
.
Other basetypes: checkArray
,
checkAtomicVector
,
checkAtomic
, checkCharacter
,
checkComplex
, checkDataFrame
,
checkDate
, checkDouble
,
checkEnvironment
,
checkFactor
, checkFormula
,
checkFunction
,
checkIntegerish
, checkList
,
checkLogical
, checkMatrix
,
checkNull
, checkNumeric
,
checkPOSIXct
, checkRaw
,
checkVector
testInteger(1L) testInteger(1.) testInteger(1:2, lower = 1, upper = 2, any.missing = FALSE)