How to replace one substring with different substrings in R? : <p>I have a vector of strings and I want to replace one common substring in all the strings with different substrings. I'm doing this in R. For example:</p>

<pre><code>input=c("I like fruits","I like you","I like dudes")
# I need to do something like this
newStrings=c("You","We","She")
gsub("I",newStrings,input)
</code></pre>

<p>so that the output should look like:</p>

<pre><code>"You like fruits"
"We like you"
"She like dudes"
</code></pre>

<p>However, gsub uses only the first string in newStrings. Any suggestions?
Thanks</p>
