Creates a color map of setNames class with names as unique group labels given a column name and values as hexcode colors.
This function is built into the composition method from the abstract class omics and inherited by other omics classes, such as;
metagenomics and proteomics.
Usage
colormap(
data,
col_name = lifecycle::deprecated(),
groups,
Brewer.palID = "Set2"
)Arguments
- data
A data.frame or data.table.
- col_name
- groups
A column name of a categorical variable in
data.- Brewer.palID
A character name that exists in brewer.pal (Default:
"Set2").
Value
A setNames.
Examples
library("data.table")
#>
#> Attaching package: ‘data.table’
#> The following object is masked from ‘package:base’:
#>
#> %notin%
dt <- data.table(
"SAMPLE_ID" = c("sample_1", "sample_2", "sample_3"),
"treatment" = c("healthy", "tumor", NA)
)
colors <- colormap(data = dt,
groups = "treatment")
