Hi, I have a large dataset "Procedure" with a category "Airway and Respiratory" with different types of ventilatory supports that patients have received in the hospital. I want to categorize patients into 3 groups based on different airway and resp managements--1) Non-invasive respiratory procedures (as defined by filtered resp procedures "bipap", "cpap", etc), 2) Invasive respiratory procedures (as defined by filter "endotracheal intubations"), and finally 3) No respiratory procedures (patients who neither received non-invasive or invasive).
I cannot figure out how to filter the last group (no resp procedure). Patients in my dataset have received multiple resp procedures, which include other things outside of non-invasive/invasive, so I cannot just filter out by "null". I just don't know how to filter those patients who DID NOT received intubations / bipap/cpap etc. I was thinking I could use ifelse, but cannot figure out a clean way to do this. Please help!
#StartRcode
Proc <- read.csv("Procedure.csv", stringsAsFactors = F)
Proc <- tbl_df(Proc)
#Cleaning data
RespProc <- filter(Proc, Category == "Airway and Respiratory")
NIRespProc <- filter(RespProc, Procedure.Name == "BiPAP" | Procedure.Name == "BiPAP (non-invasive)" | Procedure.Name == "CPAP (Non-Invasive)" | Procedure.Name == "CPAP")
InvRespProc<- filter(RespProc, Procedure.Name == "Endotracheal Intubation(and duration of intubation)")
NoRespSupport <- filter(RespProc, Procedure.Name==)