I received this error message:
Error in if (condition) { : missing value where TRUE/FALSE needed
or
Error in while (condition) { : missing value where TRUE/FALSE needed
What does it mean, and how do I prevent it?
I received this error message:
Error in if (condition) { : missing value where TRUE/FALSE needed
or
Error in while (condition) { : missing value where TRUE/FALSE needed
What does it mean, and how do I prevent it?
I ran into this when checking on a null or empty string
changed it to
The evaluation of
condition
resulted in anNA
. Theif
conditional must have either aTRUE
orFALSE
result.This can happen accidentally as the results of calculations:
To test whether an object is missing use
is.na(x)
rather thanx == NA
.See also the related errors:
Error in if/while (condition) { : argument is of length zero
Error in if/while (condition) : argument is not interpretable as logical