Suppose I have a string such like:
s <- "a bc de fg hij klmn 123 45 789"
And a vector of characters:
c <- c("a-b", "g-h", "j-k", "x-z", "y-5", "3-4")
what I wanted is substitute character such like "a b"
in s
with characters in c's "a-b"
. A desired output would be:
new_s<-"a-bc de fg-hij-klmn 123-45 789"