Partial String Match in R using the %in% operator?
问题 I'm curious to know if it is possible to do partial string matches using the %in% operator in R. I know that there are many ways to use stringr, etc. to find partial string matches, but my current code works easier using the %in% operator. For instance, imagine this vector: x <- c("Withdrawn", "withdrawn", "5-Withdrawn", "2-WITHDRAWN", "withdrawnn") I want each of these to be TRUE because the string contains "Withdrawn", but only the first is TRUE: x %in% c("Withdrawn") [1] TRUE FALSE FALSE