str_match_each | R Documentation |
Run each regex on each string.
str_match_each(string, pattern)
string |
Character vector to parse. |
pattern |
Character vector of the same length with regular expressions. Also each regular expression should have the same number of capture groups/parentheses. |
A character matrix with the matched groups.
Toby Dylan Hocking
genotype <- c("AA", "TT", "GA", "TAATAAA", "TAAATAA") two <- function(x)sprintf("^(?<A>%s)(?<B>%s)$", x, x) snp <- two("[ATCG]") taa <- two("TAA|TAAA") pat <- c(snp, snp, snp, taa, taa) str_match_each(genotype, pat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.