Hello,
I am trying to exclude some IDs that are "CLOSED" in Type A regardless of the fact if it is NEW, OLD or CLOSED IN TypeB
If I filter using
filter(!(TypeA == "CLOSED" & TypeB == "CLOSED")
Then, it deletes row with CLOSED, but still leaves rows with NEW or OLD
I would like to completely exclude those IDs that are CLOSED in TypeA, regardless if its Closed in TypeB or not.
At the same time, I do want to retain IDs with CLOSED only in Type B and not CLOSED in TypeA.
In below sample, I would like to retain 101, but I would like to exclude 104 & 106
#Sample Code
library(tidyverse)
data <- data.frame(
ID = c("101","101", "101","104", "105", "104", "106"),
TypeA = c("OLD","NEW","NEW","CLOSED", "NEW", "NEW", "CLOSED"),
TypeB = c("OLD","NEW","CLOSED","CLOSED", "NEW", "NEW", "NEW")
)
Thanks for your help!