'R Filtering with str-detect without quotations

I want to enter a word as the x value and a dataframe in the y value. Comment_text is a in each data frame. The function will produce all rows featuring the x input.

However, the function is returning rows with the letter x. If I remove the quotations, the function does not run at all.

Any alternatives?

phrases <- function(x,y) {
  all <- y %>% filter(str_detect(comment_text, 'x'))
  view(all)
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source