stri_count: Count the Number of Pattern Matches in a String

Description Usage Arguments Details Value See Also Examples

Description

A convenience function. Calls either stri_count_regex, stri_count_fixed, or stri_count_charclass, depending on the argument used.

Usage

1
stri_count(str, ..., regex, fixed, charclass)

Arguments

str

character vector of strings to search in

...

additional arguments passed to the underlying functions

regex

character vector; regular expressions

fixed

character vector; fixed patterns

charclass

character vector; identifiers of character classes

Details

Unless you are very lazy, please call the underlying functions directly for better performance.

Value

Returns an integer vector.

See Also

Other search_count: stri_count_charclass; stri_count_fixed; stri_count_regex; stringi-search

Examples

1
2
3
4
5
6
## Not run: 
s <- "Lorem ipsum dolor sit amet, consectetur adipisicing elit."
stri_count(s, fixed=letters)
stri_count(s, regex="[[:alpha:]]")

## End(Not run)

Example output

 [1] 2 0 3 2 5 0 1 0 7 0 0 2 3 2 4 2 0 3 4 5 2 0 0 0 0 0
[1] 48

stringi documentation built on May 2, 2019, 4:54 p.m.