% in% operator vs ==, NA processing

I was wondering what happened to my code, and found that the reason for my odd results was this unexpected treatment of NA with == and %in% .

 > NA %in% NA [1] TRUE > NA == NA [1] NA 

Is there a reason for this? I read about the == operator and its NA processing, but could not find any information about why the %in% operator handles NA differently.

+5
source share

Source: https://habr.com/ru/post/1265556/


All Articles