I have multiple lists of strings, like:
list1 = c("banana","orange","kiwi")
list2 = c("jackhammer","plum","drift")
These lists reflect strings in a column in my dataframe. I am looking for a way to feed my lists into a function to replace each occurrence of these strings in my dataframe with a different string. The closest I've come uses recode, where I need to write my list out again, instead of calling my list from elsewhere:
DF$Names <- recode(DF$Names, "c('jackhammer','plum','drift') = 'misc'")
However I want to know if it's possible to call the list I already made in recode or through another function, without using ifelse. I see how to do this in ifelse but I want to learn another way.