0

这是dput()信息

structure(list(Text = c("bandwidth issues. issues with vpn", 
"be more customer focussed reduce prices and offer same deas to existing customers that they use to attract new ones", 
"be more helpful and provide a better service.", "better customer service", 
"better customer service and products", "better customer service more transparency competency", 
"better customer service uk based. greater reliability and customer support", 
"better customer service. a more coherent ad that is better explained.", 
"better customer services", "better customer services and they could be truthful"
)), .Names = "Text", row.names = c(NA, -10L), class = c("tbl_df", 
"tbl", "data.frame"))

我想filter根据vector.

这是我迄今为止尝试过的,但不明白为什么它仍然会带来另一个text没有匹配的:

phrase = c("staff","agent","advisor","english","foreign","indian","gentleman","lady","man","woman","people","uk",
       "speak","supervisor","manager","spoke","spoken","non-uk","representative","he","she")

phrase_match <- str_c(phrase, collapse = "|")

brand_nps_filtered%>%
              filter(str_detect(Text, phrase_match))

如您所见,它带来了be more customer focused reduce prices and offer same deas to existing customers that they use to attract new ones其中没有任何关联关键字的phrase

4

0 回答 0