txt_count | R Documentation |
Count the number of times a pattern is occurring in text.
Pattern counting is performed by executing a regular expression using gregexpr
and
checking how many times the regular expression occurs.
txt_count(x, pattern, ...)
x |
a character vector with text |
pattern |
a text pattern which might be contained in |
... |
other arguments, passed on to |
an integer vector of the same length as x
indicating how many times the pattern is occurring in x
x <- c("abracadabra", "ababcdab", NA) txt_count(x, pattern = "ab") txt_count(x, pattern = "AB", ignore.case = TRUE) txt_count(x, pattern = "AB", ignore.case = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.