To address this gap, look at how you need to correct the missing values in the data in question so you are specific in what you are feeding into the function.
I should note that any values passed to if() for comparison must be Boolean. Any comparisons between a value and NA will always generate a result of NA (in effect, cannot be determined). If you want to test for missing values, use the is.na() function.
Or in other words, silence (Null values) is not dissent (a False value).
Error: missing value where true/false needed