I have a dataset of constructive comments and want to remove a list of common positive comments found in a csv at an early stage of analysis.
The original dataset looks similar to this:
df <-
data.frame(
"SuveyID" = 1:10,
"NI" = c(
"too many quizs",
"very vague and conflicting instructions sometimes",
"way too many emails hard to keep up",
"technology issue",
"all is good",
"all perfect",
"no improvements",
"sometimes goes off topic",
"connection issues of internet",
"all is well"
)
)
The list I need to remove looks similar to this, importantly this list come from a csv:
remove <-
data.frame(
"Strings.to.replace.with.NA" = c(
"all is good",
"all is well",
"all perfect")
)
Where a string in the remove dataset appears in the NI dataset, I would like to replace it with NA.
The problem I appear to be having is with collapse"|" across the records in the csv. I cant seem to get it to work. I have tried multiple versions of str_replace_all, str_replace, stri_detect_regex. But I dont have the pattern correct with collapse "|".
Help is greatly appreciated as always.