stringr: find rows where any column content matches a regex

Viewed 2806

Consider the following example

> data_text <- data.frame(text = c('where', 'are', 'you'),
                        blob = c('little', 'nice', 'text'))
> data_text
# A tibble: 3 x 2
   text   blob
  <chr>  <chr>
1 where little
2   are   nice
3   you   text

I want to print the rows that contain the regex text (that is, row 3)

Problem is, I have hundreds of columns and I dont know which one contains this string. str_detect only work with one column at a time...

How can I do that using the stringr package? Thanks!

3 Answers
Related