I am looking at resistance of urine infections to certain antibiotics.
The antibiotics I am looking at are nitrofurantoin (NIT), trimethoprim (TRI) and cefalexin (CLX).
I wanted to create two new columns.
Column 1:
Where there is resistance to at least 2 antibiotics
Column 2:
Where there is resistance to at least 3 antibiotics.
In the picture you should be able to see what I want it to look like.
My initial attempt at trying to do the three resistant antibiotics was as follows
Urine1 %>%
mutate(Threereesistant = case_when(
str_detect(CLX, “Resistant”) & str_detect(NIT, “Resistant”) & str_detect(TRI, “Resistant”) ~ three resistant),
TRUE~”NA”)
But it doesnt work and it wouldnt account for the multiple OR statements necessary for the 2 resistance column to work.