Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

equals-na

Flag x == NA, which is always NA rather than TRUE/FALSE — almost always a mistake for is.na(x), which is the autofix.

Comparing to NA with ==:

x == NA
warning: equals-na
 --> example.R:1:1
  |
1 | x == NA
  | ^^^^^^^ comparison with `NA` is always `NA`; use `is.na()`
  = help: Use `is.na(x)`.

After applying the fix:

is.na(x)