checkmate
checkmate copied to clipboard
`assert_date` NA missing behavior inconsistent with `assert_numeric` and others
Hello, first off thank you for this excellent package.
Secondly, this behavior seems inconsistent to me:
library(checkmate)
# Pass
assert_numeric(c(5, NA))
assert_date(c(Sys.Date(), NA))
# Pass
assert_numeric(NA)
assert_character(NA)
assert_integerish(NA)
assert_double(NA)
# Doesn't pass
assert_date(NA)
# Error: Assertion on 'NA' failed: Must be of class 'Date', not 'logical'.
This happens even though they all have the same defaults for any.missing = TRUE. Thoughts? Thanks for your time.
In your second example, c(Sys.Date(), NA) creates a Date vector, this is why it passes. @mllg Maybe check_date should get a typed.missing argument, too? Also related to https://github.com/mllg/checkmate/issues/236