Skip to contents

Apply grep to a pattern that can be comprised of multiple elements.

Usage

grep_any(x, y, match = "any", ignore.case = TRUE)

Arguments

x

A vector of elements to search for

y

A vector to search within

match

Either 'any', 'exact' or 'begins'. Default is 'any'.

ignore.case

Ignore case? Default is TRUE

Examples

x<-c(1,5,8,25)
y<-seq(0,20)
grep_any(x,y,'exact')
#> [1] 2 6 9
x<-c('4t','4r')
y<-c('3PN','4VN','4T')
grep_any(x,y)
#> [1] 3