count pattern in strings the way of pipe operator

x %count% y

Arguments

x

Pattern to count in string

y

string where to count pattern

Value

A vector of integer

Details

This functions is a pipe version of stringr::count

Examples

fruit <- c("apple", "banana", "pear", "pineapple") "a" %count% fruit
#> [1] 1 3 1 1
c("a", "b", "p", "p") %count% fruit
#> [1] 1 1 1 3