Why filterdoesn't dplyr return the same data.frame in the code below as a subset of the R base?
In fact, none of them work as expected. I would like to remove observations / rows that are at the same time b==1 AND c==1. That is, I would like to delete only the third line.
require(dplyr)
df <- data.frame(a=c(0,0,0,0,1,1,1), b=c(0,0,1,1,0,0,1), c=c(1,NA,1,NA,1,NA,NA))
filter(df, !(b==1 & c==1))
df[!(df$b==1 & df$c==1),]
source
share