title: R: Replacing values in a column with corresponding values
body: <p>How do you replace values in a column when the value fulfils certain conditions in R?</p>
  
  <p>Here I have two data frames.</p>
  
  <pre><code>Fruits &lt;- c("Apple", "Grape Fruits", "Lemon", "Peach", "Banana", "Orange", "Strawberry", "Apple")
  df1 &lt;- data.frame(Fruits)
  
  df1
     Fruits
     Apple                
     Grape Fruits             
     Lemon                
     Peach                
     Banana               
     Orange               
     Strawberry               
     Apple
  
  
  
  Name &lt;- c("Apple", "Orange", "Lemon", "Grape", "Peach","Pinapple")
  Rename &lt;- c("Manzana", "Naranja", "Limon", "Uva", "Melocoton", "Anana")
  df2 &lt;- data.frame(Name, Rename)
  
  df2
     Name       Rename
     Apple       Manzana          
     Orange      Naranja          
     Lemon       Limon            
     Grape       Uva          
     Peach       Melocoton            
     Pinapple    Anana
  </code></pre>
  
  <p>I want to replace the values in <code>df1$Fruits</code> to corresponding values in <code>df2$Rename</code>, only when each value in <code>df1$Fruits</code> matches that in <code>df2$Name</code>.</p>
  
  <p>So the designated data frame would be like this.</p>
  
  <pre><code>  Fruits
    Manzana                
    Grape Fruits             
    Limon                
    Melocoton                
    Banana               
    Naranja               
    Strawberry               
    Manzana
  </code></pre>
  
  <p>Does anybody know how to do this? Thank you very much for your help.</p>