str_detect_multi: Detect the presence or absence of multiple patterns in a...

Description Usage Arguments Value Author(s) Examples

View source: R/str_detect_multi.R

Description

A wrapper for stringr::str_detect to enable vectorised search against multiple terms, with regex and case_ignore applied by default

Usage

1
str_detect_multi(strings, patterns, ignore_case = TRUE, regex = TRUE)

Arguments

strings

A string or character vector of strings to query patterns against

patterns

A string or character vector of patterns to query against strings

ignore_case

Should case differences be ignored in the match?

regex

Whether patterns are regex or fixed (activates stringr::regex or stringr::fixed)

Value

A logical value or vector

Author(s)

Robin Edwards

Examples

1
2
3
4
5
x = rownames(mtcars)
x[str_detect_multi(x, c('merc','honda'))]

require(dplyr)
starwars %>% filter(str_detect_multi(name, c('sky','darth')))

geotheory/textools documentation built on Aug. 17, 2021, 1:18 p.m.