checkVector {checkmate} | R Documentation |
Check if an argument is a vector
checkVector(x, strict = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE) check_vector(x, strict = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE) assertVector(x, strict = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL) assert_vector(x, strict = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL) testVector(x, strict = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE) test_vector(x, strict = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE) expect_vector(x, strict = FALSE, any.missing = TRUE, all.missing = TRUE, len = NULL, min.len = NULL, max.len = NULL, unique = FALSE, names = NULL, null.ok = FALSE, info = NULL, label = vname(x))
x |
[any] |
strict |
[ |
any.missing |
[ |
all.missing |
[ |
len |
[ |
min.len |
[ |
max.len |
[ |
unique |
[ |
names |
[ |
null.ok |
[ |
.var.name |
[ |
add |
[ |
info |
[character(1)] |
label |
[ |
Depending on the function prefix:
If the check is successful, the functions
assertVector
/assert_vector
return
x
invisibly, whereas
checkVector
/check_vector
and
testVector
/test_vector
return
TRUE
.
If the check is not successful,
assertVector
/assert_vector
throws an error message,
testVector
/test_vector
returns FALSE
,
and checkVector
returns a string with the error message.
The function expect_vector
always returns an
expectation
.
Other atomicvector: checkAtomicVector
,
checkAtomic
Other basetypes: checkArray
,
checkAtomic
, checkCharacter
,
checkComplex
, checkDataFrame
,
checkDate
, checkEnvironment
,
checkFactor
, checkFunction
,
checkIntegerish
,
checkInteger
, checkList
,
checkLogical
, checkMatrix
,
checkNull
, checkNumeric
testVector(letters, min.len = 1L, any.missing = FALSE)