View source: R/checkAtomicVector.R
| checkAtomicVector | R Documentation |
An atomic vector is defined slightly different from specifications in
is.atomic and is.vector:
An atomic vector is either logical, integer, numeric,
complex, character or raw and can have any attributes except a
dimension attribute (like matrices).
I.e., a factor is an atomic vector, but a matrix or NULL are not.
In short, this is basically equivalent to is.atomic(x) && !is.null(x) && is.null(dim(x)).
checkAtomicVector(
x,
any.missing = TRUE,
all.missing = TRUE,
len = NULL,
min.len = NULL,
max.len = NULL,
unique = FALSE,
names = NULL
)
check_atomic_vector(
x,
any.missing = TRUE,
all.missing = TRUE,
len = NULL,
min.len = NULL,
max.len = NULL,
unique = FALSE,
names = NULL
)
assertAtomicVector(
x,
any.missing = TRUE,
all.missing = TRUE,
len = NULL,
min.len = NULL,
max.len = NULL,
unique = FALSE,
names = NULL,
.var.name = vname(x),
add = NULL
)
assert_atomic_vector(
x,
any.missing = TRUE,
all.missing = TRUE,
len = NULL,
min.len = NULL,
max.len = NULL,
unique = FALSE,
names = NULL,
.var.name = vname(x),
add = NULL
)
testAtomicVector(
x,
any.missing = TRUE,
all.missing = TRUE,
len = NULL,
min.len = NULL,
max.len = NULL,
unique = FALSE,
names = NULL
)
test_atomic_vector(
x,
any.missing = TRUE,
all.missing = TRUE,
len = NULL,
min.len = NULL,
max.len = NULL,
unique = FALSE,
names = NULL
)
expect_atomic_vector(
x,
any.missing = TRUE,
all.missing = TRUE,
len = NULL,
min.len = NULL,
max.len = NULL,
unique = FALSE,
names = NULL,
info = NULL,
label = vname(x)
)
x |
[ |
any.missing |
[ |
all.missing |
[ |
len |
[ |
min.len |
[ |
max.len |
[ |
unique |
[ |
names |
[ |
.var.name |
[ |
add |
[ |
info |
[ |
label |
[ |
Depending on the function prefix:
If the check is successful, the functions
assertAtomicVector/assert_atomic_vector return
x invisibly, whereas
checkAtomicVector/check_atomic_vector and
testAtomicVector/test_atomic_vector return
TRUE.
If the check is not successful,
assertAtomicVector/assert_atomic_vector
throws an error message,
testAtomicVector/test_atomic_vector
returns FALSE,
and checkAtomicVector/check_atomic_vector
return a string with the error message.
The function expect_atomic_vector always returns an
expectation.
Other basetypes:
checkArray(),
checkAtomic(),
checkCharacter(),
checkComplex(),
checkDataFrame(),
checkDate(),
checkDouble(),
checkEnvironment(),
checkFactor(),
checkFormula(),
checkFunction(),
checkInteger(),
checkIntegerish(),
checkList(),
checkLogical(),
checkMatrix(),
checkNull(),
checkNumeric(),
checkPOSIXct(),
checkRaw(),
checkVector()
Other atomicvector:
checkAtomic(),
checkVector()
testAtomicVector(letters, min.len = 1L, any.missing = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.