Let’s say I have a vector of string values that looks something like:
vec_vals<-c("value1", "value2", "value3")
and a text string which at certain points may contain those values, something like:
text_string<-"value1 blah blah blah value2"
I am trying to add a value, let’s say x.
in the text_string
in front of any of vec_vals
that appear in the text_string
, so in this case the desired result would be:
text_string_cleaned<-"x.value1 blah blah blah x.value2"
Thanks!