createColors | R Documentation |
Produce a qualitative set of colors.
createColors(variable)
variable |
character vector or factor variable. |
A named vector containing the color codes.
# Given qualitative variable
cond <- factor(c("A", "A", "B", "B", "C", "D"),
levels = c("A", "B", "C", "D"))
# Associate a color to each level (or unique value, if not a factor)
cond_colors <- createColors(cond)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.