I have a Master of colors as a list below
master <- list("Beige" = c("light brown", "light golden", "skin"),
"off-white" = c("off white", "cream", "light cream", "dirty white"),
"Metallic" = c("steel","silver"),
"Multi-colored" = c("multi color", "mixed colors", "mix", "rainbow"),
"Purple" = c("lavender", "grape", "jam", "raisin", "plum", "magenta"),
"Red" = c("cranberry", "strawberry", "raspberry", "dark cherry", "cherry","rosered"),
"Turquoise" = c("aqua marine", "jade green"),
"Yellow" = c("fresh lime")
)
and this is the datframe column that i have
df$color <- c('multi color','purple','steel','metallic','off white','raisin','strawberry','magenta','skin','Beige','Jade Green','cream','multi-colored','offwhite','rosered',"light cream")
Now i want to check if value persent in column is same as list key or same as list values
ex:
1)if df column value is off white first it should look at list keys which are Beige,off-white,Metallic... if it is present than get the value
2)it should also look at all the values that those keys have like if one of keys value is light cream than it should be considered as off-white
3)no case sensitive matters like OffWhITe == offwhite or space matters like off white==offwhite
OUTPUT
This should be the expected output
df$output <- c("Multi-colored","Purple","Metallic","Metallic","off-white","Purple","Red","Purple","Beige","Beige","Turquoise","off-white","Multi-colored","off-white","Red","off-white")
EDIT
any value in this c("multi color", "mixed colors", "mix", "rainbow","multicolored","MultI-cOlored","multi-colored","MultiColORed","Multi-colored") should be considered as Multi-colored