Closed vincentarelbundock closed 4 years ago
Probably you are after checkmate::checkAtomicVector
, or you forgot to set the strict
argument of check_vector
to TRUE
. In R, a list
is a vector, see e.g. base::is.vector(list())
. So the behaviour you described is absolutely expected. (Note that what is a vector in R can be a complex issue with some inconsistencies in edge cases - but those details are not relevant here.)
Second note: never use class(x) == "something"
. Use inherits(x, "something")
instead (or checkmate::testClass
, checkmate::testMultiClass
). See also here.
Similarly, do not use foo == TRUE
. Use isTRUE(something)
.
Probably you are after
checkmate::checkAtomicVector
, or you forgot to set thestrict
argument ofcheck_vector
toTRUE
. In R, alist
is a vector, see e.g.base::is.vector(list())
.
Thanks! This was exactly the information I needed.
Second note: never use
class(x) == "something"
. Useinherits(x, "something")
instead (orcheckmate::testClass
,checkmate::testMultiClass
). See also here.Similarly, do not use
foo == TRUE
. UseisTRUE(something)
.
Yes, I do (usually) follow these recommendations in my code. I just used this to describe the problem concisely in the title.
Thanks for the amazing package.
This behavior was very unexpected for me. Is this a bug or am I missing the logic?