annotate_factor: Generate colors and ids for categorical annotations that are...

Description Usage Arguments Value

View source: R/annotation.R

Description

Generate colors and ids for categorical annotations that are factors

Usage

1
2
annotate_factor(df, col = NULL, base = NULL, na_val = "ZZ_Missing",
  colorset = "varibow", color_order = "sort")

Arguments

df

data frame to annotate

col

name of the factor column to annotate

base

base name for the annotation, which wil be used in the desc table. If not provided, will use col as base.

na_val

The value to use to replace NAs. default = "ZZ_Missing".

colorset

The colorset to use for assigning category colors. Options are "varibow" (default), "rainbow","viridis","inferno","magma", and "terrain"

color_order

The order in which colors should be assigned. Options are "sort" and "random". "sort" assigns colors in order; "random" will randomly assign colors.

Value

A modified data frame: the annotated column will be renamed base_label, and base_id and base_color columns will be appended


AllenInstitute/scrattch.io documentation built on Nov. 17, 2021, 10:06 a.m.