Logical (0) is not equal to numeric (0). Both are not equal to null values, i.e. Is.null (logical (0)) and is.null (numeric (0)) return values are false. It is interesting to note that a zero-length value is sometimes not counted as a null value, but the definition of a null value is a parameter that is not assigned in the function, and is characterized by no value. How do I differentiate between null and NA? Very simple, the latter logical length is 1, while the former logical length is 0, meaning that if you use is.logical to determine the logical value of NA, the resulting result is true. Na can be positive infinity or negative infinity, but null always represents the concept of an empty set without this value.
Summing up the return value of is.logical (condition), the condition in parentheses is the following state:
1. Numeric (0) = = Numeric (0) and numeric (0)! = Numeric (0), returns True.
2. Logical (0), numeric (0), NULL, returns false.
3. NA, returns True.
Null there is also a problem, that is, if the condition of the If-else loop, if the occurrence of the variable is "assigned" is Null,numeric (0), or logical (0), the error message says that the length of the assignment can not be zero. The tricky here is that, although logical (0) and numeric (0) are not NULL objects, they are not logical values because the "length" of the three is zero.
Logical (0) and numeric (0) and assignment problems in the R language