checkVector {checkmate} | R Documentation |
Check if an argument is a vector
Description
Check if an argument is a vector
Usage
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
)
Arguments
x |
[any] |
strict |
[ |
any.missing |
[ |
all.missing |
[ |
len |
[ |
min.len |
[ |
max.len |
[ |
unique |
[ |
names |
[ |
null.ok |
[ |
.var.name |
[ |
add |
[ |
Value
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
/check_vector
return a string with the error message.
The function expect_vector
always returns an
expectation
.
See Also
Other basetypes:
checkArray()
,
checkAtomic()
,
checkAtomicVector()
,
checkCharacter()
,
checkComplex()
,
checkDataFrame()
,
checkDate()
,
checkDouble()
,
checkEnvironment()
,
checkFactor()
,
checkFormula()
,
checkFunction()
,
checkInteger()
,
checkIntegerish()
,
checkList()
,
checkLogical()
,
checkMatrix()
,
checkNull()
,
checkNumeric()
,
checkPOSIXct()
,
checkRaw()
Other atomicvector:
checkAtomic()
,
checkAtomicVector()
Examples
testVector(letters, min.len = 1L, any.missing = FALSE)