colormap: Color map of a variable

View source: R/colormap.R

colormapR Documentation

Color map of a variable

Description

Creates an object of hexcode colors with names given a vector of characters. This function is built into the ordination method from the abstract class omics and inherited by other omics classes, such as; metagenomics and proteomics.

Usage

colormap(data, col_name, Brewer.palID = "Set2")

Arguments

data

A data.frame or data.table.

col_name

A column name of a categorical variable.

Brewer.palID

A character name that exists in brewer.pal (Default: "Set2").

Value

A setNames.

Examples

library("data.table")
dt <- data.table(
  "SAMPLE_ID" = c("sample_1", "sample_2", "sample_3"),
  "treatment" = c("healthy", "tumor", NA)
)

colors <- colormap(data = dt,
                   col_name = "treatment")

OmicFlow documentation built on Sept. 9, 2025, 5:24 p.m.