groupCols {colouR} | R Documentation |
groupCols
Description
Group Hex Colors. This function takes a vector of hex color values and groups them using k-means clustering in the RGB color space. It returns a data frame with the original hex colors and their assigned group labels.
Usage
groupCols(hex_colors, n_clusters = 5)
Arguments
hex_colors |
A character vector of hex color values. |
n_clusters |
The number of clusters (groups) to use in the k-means clustering. Default is 5. |
Value
A data frame with the original hex colors and their assigned group labels.
Examples
hex_colors <- c("#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF")
groupCols(hex_colors, n_clusters = 2)
[Package colouR version 0.1.1 Index]