title: Variable substitution - R
body: <p>Very simple question, but am struggling to find the solution.  </p>
  
  <p>Want to go from this:</p>
  
  <pre><code>a = c("the sky is color", "the color dog", "grass is color") 
  b = c("blue","brown","green") 
  df = data.frame(a,b) 
  </code></pre>
  
  <p>To this:</p>
  
  <pre><code>a = c("the sky is color", "the color dog", "grass is color") 
  b = c("blue","brown","green") 
  c = c("the sky is blue", "the brown dog", "grass is green")
  df = data.frame(a,b,c) 
  </code></pre>
  
  <p>Tried using gsub:</p>
  
  <pre><code>df$d &lt;- gsub('color', df$b, df$a)
  </code></pre>
  
  <p>But received this error message: </p>
  
  <pre><code>argument 'replacement' has length &gt; 1 and only the first element will be used 
  </code></pre>
  
  <p>Will the solution also work for integers?  Thank you!</p>