Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/brutegenerator.R
Generates "color" coding schemes used to mark and identify individual animals. The codes are robust to an arbitrary number of partial erasures. This method uses a sloppy, very slow, stochastic brute force method.
1 2 3 4 5 6 7 |
total.length |
the number of unique positions to be marked on the animal. (This can be thought of as the total number of positions on which color bands or paint marks will be applied.) |
redundancy |
the number of erasures that can occur without disrupting surety of unique identification. This value determines how robust the scheme is to erasures. |
alphabet |
an integer representing the 'alphabet size.' This is the number of unique markings (think different paint colors, symbols, or varieties of bands) at your disposal.Note: unlike the Reed-Solomon inspired function, |
num.tries |
the number of iterations that will be run before choosing the best option. Increasing this number increases the running time. |
available.colors |
an optional list of strings that contains the names of the unique markings which compose the given 'alphabet' (e.g. "blue", "red", "yellow", etc.). If left blank, the mapping can be done at any later time using |
This function generates the list of all possible unique ID codes given the 'alphabet size' (alphabet
) and the number of unique positions available for marking (total.length
). The list of combinations is then iteratively pruned down until the required robustness has been reached; the distance between any two ID codes must greater than the value specified in redundancy
.
However, the iterative pruning is done randomly, so it is likely that resulting list of codes does not contain the maximum possible number of robust codes. Thus, the process is repeated multiple times (num.tries
) and the list that contains the largest number of robust codes is kept and returned.
a list of unique ID codes that fit the provided parameters.
If an appropriate argument for available.colors
is provided, each code will be a sequence of strings, otherwise, each code will be a sequence of numeric values.
the rs_IDs
function always generates the maximum number of unique codes per scheme. However, rs_IDs
suffers from certain limitations that brute_IDs
does not: it requires alphabet
to be a prime number, total.length
to be less than or equal to alphabet
, etc.
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
rs_IDs
, tweaked_IDs
, simple_IDs
. Also see the vignette loosebirdtag
for demonstrations and additional uses.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | total.length <- 6 #we have six positions to mark,
redundancy <- 2 #we want surety even with two erasures,
alphabet <- 4 #and we currently have five types of paint in stock
#This gives a warning because rs_IDs() only accepts
#a pretty constrained set of parameters
codes <- rs_IDs(total.length, redundancy, alphabet)
length(codes)
#However, we can do it with brute_IDs() to get more unique IDs
codes <- brute_IDs(total.length, redundancy, alphabet, num.tries = 1)
length(codes)
#Let's make those into human-readable color sequences
color.names <- c("blue","red","green","pink","yellow-with-a-stripe")
color.codes <- codes_to_colors(codes, color.names)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.