R/assignment_utils.R
is_mt_or_na.Rd
If I want to check whether an element in a list is missing, sometimes it's
NA
, but sometimes it is simply a vector of length 0. This checks for both
possibilities.
is_mt_or_na(x)
A vector of any type, of length 0 or 1
TRUE if the vector has length 0 or is NA
is_mt_or_na(character(0))
#> [1] TRUE
is_mt_or_na(NA_character_)
#> [1] TRUE
is_mt_or_na("foo")
#> [1] FALSE