PatternInfo {GrpString} | R Documentation |
PatternInfo discovers the starting position of each pattern that occurs first or last as well as the number of patterns in each string.
PatternInfo(patterns, strings, rev = FALSE)
patterns |
Pattern vector. |
strings |
String vector. |
rev |
Determine whether returning the starting positions of patterns that occur first or last in strings. Default is first. |
Returns a data frame, which contains the length of each string, and the starting position of each pattern in each string.
# simple strings and patterns
strs.vec <- c("ABCDdefABCDa", "def123DC", "123aABCD", "ACD13", "AC1ABC", "3123fe")
patts <- c("ABC", "123")
PatternInfo(patts, strs.vec)
# simple strings and patterns, starting position of last pattern
strs.vec <- c("ABCDdefABCDa", "def123DC", "123aABCD", "ACD13", "AC1ABC", "3123fe")
patts <- c("ABC", "123")
PatternInfo(patts, strs.vec, rev = TRUE)