# Example lookup table
lut <- c(
"4" = "four wheel drive",
"r" = "rear wheel drive",
"f" = "front wheel drive"
)
# Typical usage
demo_discrete(c("4", "r", "f"), labels = label_dictionary(lut))
# By default, extra values ('w') will remain as-is
demo_discrete(c("4", "r", "f", "w"), labels = label_dictionary(lut))
# Alternatively, you can relabel extra values
demo_discrete(
c("4", "r", "f", "w"),
labels = label_dictionary(lut, nomatch = "unknown")
)
Run the code above in your browser using DataLab