countPatternMatches: Count how many matches are generated by each pattern.

Description Usage Arguments Details Value

View source: R/countPatternMatches.R

Description

Count how many matches are generated by each pattern.

Usage

1
countPatternMatches(X, patterns)

Arguments

X

A character vector where matches are sought.

patterns

A vector of regular expression patterns.

Details

This is meant to be useful when developing a vector of regexes to apply to text. Unlike patternappy(), which only finds the first regex that matches each element of text, a text element here can match multiple regexes. Therefore, the sum of the returned vector may not equal the length of the input X.

Value

A integer vector of same length as patterns with a count of matches.


eamoncaddigan/patternapply documentation built on May 13, 2017, 10:56 a.m.