#############################################################################
# EXAMPLE 1: Toy example
#############################################################################
vec <- c("abcd", "bcde", "aedf", "cdf" )
# search for entries in vec with contain 'a' and 'f'
# -> operator="AND"
grep.vec( pattern.vec=c("a","f"), x=vec )
## $x
## [1] "aedf"
## $index.x
## [1] 3
grepvec( pattern.vec=c("a","f"), x=vec, value=TRUE)
grepvec( pattern.vec=c("a","f"), x=vec, value=FALSE)
# search for entries in vec which contain 'a' or 'f'
grep.vec( pattern.vec=c("a","f"), x=vec, operator="OR")
## $x
## [1] "abcd" "aedf" "cdf"
## $index.x
## [1] 1 3 4
Run the code above in your browser using DataLab