re2_count | R Documentation |
Vectorized over string and pattern. Match against a string using a regular expression and return the count of matches.
re2_count(string, pattern)
string |
A character vector, or an object which can be coerced to one. |
pattern |
Character string containing a regular expression,
or a pre-compiled regular expression (or a vector of character
strings and pre-compiled regular expressions). |
An integer vector.
re2_regexp
for options to regular expression,
re2_syntax for regular expression syntax.
color <- c("yellowgreen", "steelblue", "goldenrod", "forestgreen")
re2_count(color, "e")
re2_count(color, "r")
# Regular expression vs literal string
re2_count(c("..", "a...", "foo.b"), ".")
re2_count(c("..", "a...", "foo.b"), re2_regexp(".", literal = TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.