Reputation: 107
I have data from YouTube captions. Some inappropriate words are shown by [Â __Â ] in excel file. When I read the data in R it appears as [ __ ]. I am using str_contains in order to identify any inappropriate words in the text but it isn't able to identify [ __ ] in R. grepl is also not helping my cause.
I will appreciate any help.
text <- "oh well holy [ __ ] this is right there is"
str_contains("[ __ ]", text)
Upvotes: 0
Views: 41
Reputation: 12558
Neil was right, the parameters were the wrong way around:
pacman::p_load(sjmisc)
text <- "oh well holy [ __ ] this is right there is"
pattern <- "[ __ ]"
str_contains(pattern, text) # FALSE
str_contains(text, pattern) # TRUE
Upvotes: 0