How to replace a string defined by starting and ending index by another string in R?
string <- "this is a funny cat" I want to replace the first 15 characters of string with ‘orange`. The desired output is ‘orange cat’ However, using substr gives me substr(string, 1, 15) <- "orange" > string [1] "oranges a funny cat" which is not the desired output. >Solution : The output of substr should… Read More How to replace a string defined by starting and ending index by another string in R?