Tag: R pattern matching vector

  • Detect combination of multiple strings in R

    Detect combination of multiple strings in R

    Here is how to detect multiple strings in R using base function grepl and alternatives, like str_detect from package stringr. There will be two main scenarios – detection of multiple strings simultaneously and any of the given strings.