avgHex {colouR} | R Documentation |
avgHex
Description
Average Hex Colors per Group. This function takes a data frame with two columns: one for the hex color values and another for the group labels. It calculates the average color for each group and returns a data frame with the group labels and their corresponding average hex colors.
Usage
avgHex(df, hex_col, group_col)
Arguments
df |
A data frame with columns for hex color values and group labels. |
hex_col |
The name of the column containing hex color values. Default is "hex". |
group_col |
The name of the column containing group labels. Default is "group". |
Value
A data frame with the group labels and their corresponding average hex colors.
Examples
df <- data.frame(
hex = c("#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF"),
group = c(1, 1, 2, 2, 3)
)
avgHex(df, hex_col = "hex", group_col = "group")
[Package colouR version 0.1.1 Index]