# Example variables
animal <- "penguin"
species <- c("Adelie", "Chinstrap", "Emperor", "Gentoo")
# Typical use, note that {x} will become the breaks
demo_discrete(species, labels = label_glue("The {x}\n{animal}"))
# It adapts to the breaks that are present
demo_discrete(species[-3], labels = label_glue("The {x}\n{animal}"))
# Contrary to directly glueing species + animal, which results in mislabelling!
demo_discrete(species[-3], labels = glue::glue("The {species}\n{animal}"))
Run the code above in your browser using DataLab