title: Replacing strings with lookup table dplyr
body: <p>I am trying to create a look up table in R in order to get my data in the same format as the company that I am working for.</p>
  
  <p>It regards different education categories that I want to merge using dplyr. </p>
  
  <pre><code>library(dplyr)
  
  # Create data
  education &lt;- c("Mechanichal Engineering","Electric Engineering","Political Science","Economics")
  
      data &lt;- data.frame(X1=replicate(1,sample(education,1000,rep=TRUE)))
  
      tbl_df(data)
  
      # Create lookup table
      lut &lt;- c("Mechanichal Engineering" = "Engineering",
               "Electric Engineering" = "Engineering",
               "Political Science" = "Social Science",
               "Economics" = "Social Science")
  
      # Assign lookup table
      data$X1 &lt;- lut[data$X1]
  </code></pre>
  
  <p>But in my output my old values are replace with the wrong ones, i.e. not the ones that I created in the lookup table. Rather it seems like the lookup table is assign randomly. </p>