r - Error in if/while (condition) {: missing Value where TRUE/FALSE needed -
i received error message:
error in if (condition) { : missing value true/false needed
or
error in while (condition) { : missing value true/false needed
what mean, , how prevent it?
the evaluation of condition
resulted in na
. if
conditional must have either true
or false
result.
if (na) {} ## error in if (na) { : missing value true/false needed
this can happen accidentally results of calculations:
if(true && sqrt(-1)) {} ## error in if (true && sqrt(-1)) { : missing value true/false needed
to test whether object missing use is.na(x)
rather x == na
.
see related errors:
error in if/while (condition) { : argument of length zero
error in if/while (condition) : argument not interpretable logical
if (null) {} ## error in if (null) { : argument of length 0 if ("not logical") {} ## error: argument not interpretable logical if (c(true, false)) {} ## warning message: ## condition has length > 1 , first element used
Comments
Post a Comment