Hi, apologies since I am new to this and I am sure is a fairly basic question but all the answers I come across seem far too complex for what I want to do.
I am trying to create a logical variable based on whether there is a string match for any 5 words.
df$haskeywords <- str_detect(df$text,
pattern=fixed ("keyword1","keyword2","keyword3","keyword4","keyword5"))
Have also tried
df %>% mutate(newvar = text %in% Keywords)
with "Keywords" being a value with the 5 keywords in it.
Thank you in advance.
(I understand your anger at people not spending more time learning the language, I truly do but I lack the time and I've already spent 4 hours on tutorials trying to fix just this.)