Base != seems to drop NA values.
This does not make sense, and would result in lots of people unintentionally dropping NA values.
library(dplyr)
df <- iris %>%
as_tibble() %>%
mutate(Species = as.character(Species)) %>%
mutate(Species = ifelse(Species == "setosa", NA, Species)) %>%
distinct(Species)
df
df %>%
filter(Species != "virginica")
A proposed solution is that dplyr creates it's own != that masks the base != and keeps NAs