Using the iris dataset as an example,
what you can do is:
library(tidyverse)
iris %>%
summarize(across(everything(), ~ sum(str_detect(., 'setosa'))))
Of course, you‘d need to change the seqrch term to what you need.
If you want to have dedicated columns for each of your search patterns, you could alternatively do sth. like:
df <- data.frame(x = sample(letters, 10, replace = TRUE),
y = sample(letters, 10, replace = TRUE))
df |>
summarize(across(c(x, y), ~sum(str_count(., c("u"))), .names = "{.col}_u"),
across(c(x, y), ~sum(str_count(., c("g"))), .names = "{.col}_g"))
Here I'M searching for letters "u" and "g", respectively.