match_vector: Generate a Regular Expression for Finding Any of a Vector of...

Description Usage Arguments Details Value Examples

View source: R/match_vector.R

Description

Generate a Regular Expression for Finding Any of a Vector of Patterns

Usage

1

Arguments

pattern

A character vector containing a series of words or stringi-search-regexs, any one of which is sufficient for a match

Details

match_vector is a convenience function that creates a regular expression pattern for finding any of a vector of words (or other regular expression patterns)

Value

A regular expression pattern

Examples

1
2
3
4
5
colors <- c("red", "blue", "yellow")
sentences <- c("The car parked by their house was red",
               "The yellow cat enjoys the sun atop the car's roof",
               "The blue city bus passed right by the stopped car")
stringr::str_detect(sentences, match_vector(colors))

mariolaespinosa/historicalnetworks documentation built on Feb. 9, 2022, 12:31 p.m.