GrepLoop: Searches for a list of patterns within a list of strings.

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Given a vector of patterns and a vector of strings, this searches for the patterns within the strings and returns the matching locations.

Usage

1
GrepLoop(patternVec, x, ignore.case=TRUE, boolean=FALSE)

Arguments

patternVec

A vector of pattern strings to search for.

x

A vector of strings to search through using grep.

ignore.case

Indicates if the matches are case-sensitive.

boolean

Controls whether an index of integers or booleans is returned.

Details

This function applies grep multiple times.

Value

A vector of indices indicating which elements in x match any of the patterns in patternVec.

Author(s)

Justin Hemann <support@causata.com>

See Also

grep.

Examples

1
2
3
4
pats <- c("gray", "grey")
x <- c("dark gray", "yellow", "light grey", "red")
# The first and third elements in x match the patterns
GrepLoop(pats, x)

Causata documentation built on May 2, 2019, 3:26 a.m.

Related to GrepLoop in Causata...