This is kind of hard to explain, so please bear with me.
I would like to do a "find/replace" using a list of strings to "find" and an empty string ("") to replace. I have a large data table column I'd like to do this find/replace on.
Using base R, I can't figure out how to use a pattern list in gsub.
I have made a loop, but if someone could help me figure out how to use one of the apply functions (or something else in just base R), that would be MUCH more efficient and I would greatly appreciate it.
This works, but takes SO long:
for(i in 1:GarbMax){
Table.All$Cleaned<-gsub(garbage[i], "", Table.All$Cleaned, ignore.case = TRUE, fixed = TRUE)
}
The list of values I'd like to find are in "garbage", the field I'm looking for them in is "Table.All$Cleaned". "GarbMax" is just the max value of the "garbage" list.
As an aside (maybe), the above code gives me a warning that ignore.case=TRUE is being ignored. Any idea why?
Thanks so much for your help!