my.grepl: A list version of grepl

Description Usage Arguments Value Examples

View source: R/my.grepl.R

Description

This function extends grepl to searche a vector of regular expressions, to ask: "which elements contain any/all of these regular expressions?"

Usage

1
my.grepl(vec, ..., fun = c("any", "all"))

Arguments

vec

character vector of regular expressions

...

arguments passed to /codegrepl

fun

specifies the aggregation of logicals to /codevec. If /code'any' is #' specified, /codeTRUE will return if any of the regular expressions are found. If /code'all' is specified, /codeTRUE will return only if each regular expression is found.

Value

logical vector

Examples

1
2
3
4
words <- c('antihistamine', 'antechamber', 'octopus')
re <- c('anti', 'am')
my.grepl(re, words, fun = 'any')
my.grepl(re, words, fun = 'all')

nickfishbane/fishyTools documentation built on May 23, 2019, 4:47 p.m.