strs_count | R Documentation |
strs_count
counts the number of times a specified substring occurs in each
element of a character vector. Optionally, the search can be limited to a
substring of each element, specified by start
and end
positions. This
function is similar to Python's str.count()
method.
strs_count(string, substring, start = 1L, end = -1L)
string |
A character vector where each element is a string in which to
count occurrences of |
substring |
The substring to count within each element of |
start |
An optional integer specifying the starting position in each
element of |
end |
An optional integer specifying the ending position in each element
of |
An integer vector of the same length as string
, with each element
indicating the count of substring
in the corresponding element of string
.
Python str.count() documentation
strs_count("hello world", "o")
strs_count("banana", "na")
strs_count("hello world", "o", start = 6)
strs_count("hello world", "o", end = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.