uniqID_hier_maker {baRcodeR}R Documentation

Make hierarchical ID codes

Description

Generate hierarchical ID codes for barcode labels. Hierarchical codes have a nested structure: e.g. Y subsamples from each of X individuals. Use uniqID_maker for sequential single-level labels. Can be run in interactive mode, prompting user for input. The data.frame can be saved as CSV for (i) the create_PDF function to generate printable QR-coded labels; and (ii) to downstream data collection using spreadsheet, relational database, etc.

Usage

uniqID_hier_maker(user = FALSE, hierarchy, end = NULL, digits = 2)

Arguments

user

logical. Run function using interactive mode (prompts user for parameter values). Default is FALSE

hierarchy

list. A list with each element consisting of three members a vector of three elements (string, beginning value, end value). See examples. Used only when user=FALSE)

end

character. A string to be appended to the end of each label.

digits

numerical. Default is 2. Number of digits to be printed, adding leading 0s as needed. This will apply to all levels when user=FALSE. When the max number of digits in the ID code is greater than number of digits defined in digits, then digits is automatically increased to avoid errors.

Value

data.frame of text labels in the first column, with additional columns for each level in the hierarchy list, as defined by the user.

See Also

uniqID_maker

Examples

if(interactive()){
## for interactive mode
uniqID_hier_maker(user = TRUE)
}

## how to make hierarchy list

## create vectors for each level in the order string_prefix, beginning_value,
## end_value and combine in list

a <- c("a", 3, 6)
b <- c("b", 1, 3)
c <- list(a, b)
Labels <- uniqID_hier_maker(hierarchy = c)
Labels

## add string at end of each label
Labels <- uniqID_hier_maker(hierarchy = c, end = "end")
Labels


[Package baRcodeR version 0.1.7 Index]