Hi,
I have this code in R:
LAB<-LAB %>% mutate(CP= ifelse(grepl('VIM|NDM|KPC|IMP|blaOXA|OXA-48|carbapenemase', LAB$LocalOrganismDescription, ignore.case = TRUE), 1, 0))
for creating a new column CP with the values extracted from "LocalOrganismDescription" variable.
This worked perfectly, but when I added values extraction from another variable such as:
LAB<-LAB %>% mutate(CP= ifelse(grepl('VIM|NDM|KPC|IMP|blaOXA|OXA-48|carbapenemase', LAB$LocalOrganismDescription, ignore.case = TRUE)|grepl('VIM|NDM|KPC|IMP|blaOXA|OXA-48|carbapenemase', LAB$LocalTestDescription, ignore.case = TRUE), 1, 0))
I had this error:
Error in mutate()
:
In argument:
CP = ifelse(...)
.
Caused by error:
! CP
must be size 6300 or 1, not 0.
I'm not sure what is the reason for this error. Any help is really appreciated.
Thank you