powered by
grep a string whether in another string or vector, the string are split by space.
grep_split(keyword, x)
a character string, separator "|" is permitted.
a character vector where matches are sought.
The function return the numbers vector which contain the keyword.
Extention for grep functin.
grep
# NOT RUN { x <- c("you and he and I", "you", "Tom", "I", "you and I", "he and I") grep_split("you and I | Tom", x) #[1] 1 5 3 # }
Run the code above in your browser using DataLab