Is it possible to filter a data.frame for complete cases using dplyr? complete.cases
with a list of all variables works, of course. But that is a) verbose when there are a lot of variables and b) impossible when the variable names are not known (e.g. in a function that processes any data.frame).
library(dplyr)
df = data.frame(
x1 = c(1,2,3,NA),
x2 = c(1,2,NA,5)
)
df %.%
filter(complete.cases(x1,x2))
complete.cases
doesn't just accept vectors. It takes whole data frames, as well. – jorandplyr
's filter function. I guess I wasn't clear enough and updated my question. – user2503795