read_color_code | R Documentation |
read_color_code
reads a file with given group names and color codes
and returns a dataframe with group names and color codes that can be
accepted by visualization functions.
read_color_code(file, header = FALSE, sep = "\t")
file |
the name of the file which the data are to be read from.
Each row of the table appears as one line of the file. If it does
not contain an absolute path, the file name is
relative to the current working directory,
Alternatively,
|
header |
a logical value indicating whether the file contains the
names of the variables as its first line. If missing, the value is
determined from the file format: |
sep |
the field separator character. Values on each line of the
file are separated by this character. If |
The given files should contain two columns. The first column should consist of the names of the labels, and the second column should contain standard Hex color codes.
A dataframe that contains color codes for samples from different groups. The first column consists of names of the groups and the second column contains the coresponding color codes.
test1 <- data.frame(c('a','b','c'), c("#f97f6c", "#6dcff6", "#fdbc4b")) tf <- tempfile() write.table(test1, tf, row.names = FALSE, col.names = FALSE, sep = "\t") check_color_code(read_color_code(tf)) unlink(tf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.