In R programming, you wouldn't get a TRUE or FALSE if you perform X != X when X is NA (Not Applicable). The result would be NA itself as it can't be determined.
You will have to use is.na(X) to find is X is NA.
So you don't just handle TRUE and FALSE cases but take NA into consideration as well.