patternapply

Iteratively try patterns against a character vector.
git clone https://git.eamoncaddigan.net/patternapply.git
Log | Files | Refs | README | LICENSE

countPatternMatches.Rd (888B)


      1 % Generated by roxygen2: do not edit by hand
      2 % Please edit documentation in R/countPatternMatches.R
      3 \name{countPatternMatches}
      4 \alias{countPatternMatches}
      5 \title{Count how many matches are generated by each pattern.}
      6 \usage{
      7 countPatternMatches(X, patterns)
      8 }
      9 \arguments{
     10 \item{X}{A character vector where matches are sought.}
     11 
     12 \item{patterns}{A vector of regular expression patterns.}
     13 }
     14 \value{
     15 A integer vector of same length as \code{patterns} with a count of 
     16   matches.
     17 }
     18 \description{
     19 Count how many matches are generated by each pattern.
     20 }
     21 \details{
     22 This is meant to be useful when developing a vector of regexes to 
     23   apply to text. Unlike \code{patternappy()}, which only finds the first 
     24   regex that matches each element of text, a text element here can match 
     25   multiple regexes. Therefore, the sum of the returned vector may not equal 
     26   the length of the input \code{X}.
     27 }
     28