assertthat
assertthat copied to clipboard
is.flag(NA) returns TRUE
is.count(NA) returns FALSE is.number(NA) returns FALSE is.string(NA) returns FALSE
but is.flag(NA) returns TRUE
this seems inconsistent to me and is annoying because it then requires use of noNA()
Example code
is.flag(NA) is.count(NA) is.number(NA) is.string(NA)
on version 0.1
That's because NA
is logical: cf. NA_character_
, NA_real_
, NA_integer_
.
I didn't know that!
However I would still like a function that confirms a variable has the value TRUE or FALSE versus any other possible value.
Is it possible to add such a function to assert_that?
Say something like:
is.indicator is.TF
What about is.flag(x, naok = FALSE)
? Or is.flag(x, nona = TRUE)
Sweet!
My vote is for is.flag(x, nona = TRUE)
(for consistency with noNA
)