You can use the following for complete.cases in filter function:
library(dplyr)
df = data.frame(
x1 = c(1,2,3,NA),
x2 = c(1,2,NA,5)
)
df %>% filter(complete.cases(.))
x1 x2
1 1 1
2 2 2
You can also use the tidyr package as follows:
library(tidyr)
df %>% drop_na
x1 x2
1 1 1
2 2 2
If you want to filter based on one variable's missingness, use a conditional as follows:
df %>% filter(!is.na(x1))
x1 x2
1 1 1
2 2 2
3 3 NA