checkColorMap {easy.utils} | R Documentation |
Check color map for a factor
Description
Function to make sure that all levels of a factor map to distinct colors.
Usage
checkColorMap(x, colors = NULL, ...)
## Default S3 method:
checkColorMap(x, colors = NULL, ...)
Arguments
x |
An R object contains the factor vector to be checked. |
colors |
A named vector, whose names are factor levels and values are
colors. If is |
... |
Arguments passed to other methods. |
Value
An updated colors
vector, whose names are identical to the
levels.
Examples
## Assign colors for a character or factor vector.
xx <- sample(LETTERS, 10)
cols <- setColor(xx)
## Ensure each level in 'xx' get a color
checkColorMap(xx, cols)
[Package easy.utils version 0.0.4 Index]