CountMatches: Count the number of the matches of a pattern in a string.
Description
Vectorised over string and pattern.
Usage
CountMatches(string, pattern)
Arguments
string
A character vector.
pattern
A character vector. Pattern(s) specified like the pattern(s)
in the stringr package (e.g. look at stringr::str_locate()). If
this has length >1 its length must be the same as that of string.
Value
A numeric vector giving the number of matches in each string.