Description Usage Arguments Value Author(s) References Examples
View source: R/codestocolors.R
This is a helper function that transforms a list numeric ID sequences into a list of human-readable sequences. Sequences of 1s, 2s, and 3s can become sequences of "red"s, "blue"s, and "yellow"s, etc.
1 | codes_to_colors(codes, available.colors = NULL)
|
codes |
a list or matrix of numeric ID sequences generated by |
available.colors |
a list of strings that contains the names of the unique markings which compose the given 'alphabet' (e.g. "blue", "red", "yellow", etc.). The length of this list must match the 'alphabet size' used to generate the input |
a list of unique, named codes that fit the provided parameters.
Andrew Burchill, andrew.burchill@asu.edu
Burchill, A. T., & Pavlic, T. P. (2019). Dude, where's my mark? Creating robust animal identification schemes informed by communication theory. Animal Behaviour, 154, 203-208. doi:10.1016/j.anbehav.2019.05.013
1 2 3 4 5 6 7 8 9 10 11 12 13 | total.length <- 3 #we have three positions to mark,
redundancy <- 1 #we want codes robust to a single erasure,
alphabet <- 3 #and we currently have three types of paint in stock
#Create a list of codes
codes <- rs_IDs(total.length, redundancy, alphabet)
#Let's make those into human-readable color sequences
color.names <- c("blue","red","pink-striped-orange")
codes_to_colors(codes, color.names)
#We can also skip the whole function and plug the names straight into the code generator
rs_IDs(total.length, redundancy, alphabet, available.colors = color.names)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.