df2colorSub: Convert data.frame to categorical colors

df2colorSubR Documentation

Convert data.frame to categorical colors

Description

Convert data.frame to categorical colors

Usage

df2colorSub(x, colorSub = NULL, verbose = FALSE, ...)

Arguments

x

data.frame

colorSub

vector of colors, whose names are intended to match values in the input data.frame x.

verbose

logical indicating whether to print verbose output.

...

additional parameters are passed to colorjam::group2color().

Details

This function is a temporary placeholder function which simply provides categorical colors for values in each column of the input data.frame. If colors are provided using the named color vector colorSub, they are used to substitute values in each column, otherwise colorjam::group2colors() is used to create categorical colors, which itself uses colorjam::rainbowJam().

Note that providing colorSub helps keep colors consistent, otherwise each column is independently colorized.

Value

data.frame of the same dimensions as the input x data.frame, where values have been substituted with R colors.

Examples

colorSub1 <- colorjam::group2colors(LETTERS[1:6]);
df <- data.frame(one=LETTERS[1:6],
   two=rep(LETTERS[3:4], each=3),
   three=rep(LETTERS[5:6], 3));
dfColors <- df2colorSub(df, colorSub1);
jamba::imageByColors(dfColors, cellnote=df);

# Or in one step
jamba::imageByColors(df2colorSub(df), cellnote=df);


jmw86069/jambio documentation built on Nov. 29, 2022, 11:08 a.m.