# Define format
fmt1 <- value(condition(x == "A", "Label A"),
condition(x == "B", "Label B"),
condition(TRUE, "Other"))
# Extract labels
labels(fmt1)
# [1] "Label A" "Label B" "Other"
Run the code above in your browser using DataLab