Learn R Programming

OmicFlow (version 1.5.0)

colormap: 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")

Value

A setNames.

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").

Examples

Run this code
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")

Run the code above in your browser using DataLab