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

Description Usage Arguments Details Value

Description

Count how many matches are generated by each pattern.

Usage

1

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 15, 2019, 7:27 p.m.