factor_palette: Create a named color palette for a factor

Description Usage Arguments Details Value

Description

Create a named color palette for a factor

Usage

1

Arguments

x

A factor or character vector to use for the levels

colors

A vector of colors

...

Here, the user can provide numeric index values for colors that should be used first, second, third, and so on in the palette. This allows for the colors to be rearranged if they are not quite cutting it in the default order.

Details

This function may be most useful in conjunction with dput(), which will print out the code for the resultant palette. This way, color palettes can be hard-coded into scripts, which will preserve the color scheme even if the levels of the factor were to change in the future.

Value

A named vector of colors corresponding to the factor.


kylebittinger/pheatbuilder documentation built on Dec. 21, 2021, 8:45 a.m.