annotate_factor | R Documentation |
Generate colors and ids for categorical annotations that are factors. From libary(scrattch.io)
annotate_factor(df, col = NULL, base = NULL, na_val = "ZZ_Missing", colorset = "varibow", color_order = "sort")
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. |
A modified data frame: the annotated column will be renamed base_label, and base_id and base_color columns will be appended
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.