It appears that while grep
has an invert argument, grepl
does not.
I would like to subset for using 2 filters
data$ID[grepl("xyx", data$ID) & data$age>60]
How can I subset for age>60 and ID not containing "xyx"? What I did is
data$ID[abs(grepl("xyx", data.frame$ID)-1) & data$age>60]
which apparently works, but looks awful and unintuitive. Is there a nicer solution/argument?