Error: missing value where TRUE/FALSE needed

This error arises when you sending a missing value (Null or N/A) to a field where a Boolean True / False is required. While many other languages (such as JavaScript) have relatively broad standards of what qualifies as False (that includes Null values), R applies a more rigorous standards. Boolean values are Boolean values. Null and missing values are null and missing values.

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

Scroll to top
Privacy Policy