How to subset data in R without losing NA rows?
The post above subsets using logical indexing. Is there a way to do it in dplyr?
Also,
If you want to keep NAs created by the filter condition you can simply turn the condition NAs into TRUEs using replace_na from tidyr.
replace_na
a <- data.frame(col = c("hello", NA, "str")) a %>% filter((col != "str") %>% replace_na(TRUE))