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.
It regards different education categories that I want to merge using dplyr.
library(dplyr)
# Create data
education <- c("Mechanichal Engineering","Electric Engineering","Political Science","Economics")
    data <- data.frame(X1=replicate(1,sample(education,1000,rep=TRUE)))
    tbl_df(data)
    # Create lookup table
    lut <- c("Mechanichal Engineering" = "Engineering",
             "Electric Engineering" = "Engineering",
             "Political Science" = "Social Science",
             "Economics" = "Social Science")
    # Assign lookup table
    data$X1 <- lut[data$X1]
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.
 
     
     
    