codes_to_colors: Converting numeric ID codes to listed color name codes

Description Usage Arguments Value Author(s) References Examples

View source: R/codestocolors.R

Description

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.

Usage

1
codes_to_colors(codes, available.colors = NULL)

Arguments

codes

a list or matrix of numeric ID sequences generated by rs_IDs, brute_IDs, etc.

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 codes.

Value

a list of unique, named codes that fit the provided parameters.

Author(s)

Andrew Burchill, andrew.burchill@asu.edu

References

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

Examples

 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)

rabi documentation built on Dec. 10, 2019, 1:08 a.m.