| uniqID_maker {baRcodeR} | R Documentation |
Create ID codes consisting of a text string and unique numbers (string001, string002, ...).
Can be run in interactive mode, prompting user for input. The data.frame
output can be saved as CSV for (i) the create_PDF function
to generate printable QR-coded labels; and (ii) to downstream data
collection software (spreadsheets, relational databases, etc.)
uniqID_maker(user = FALSE, string = NULL, level, digits = 3)
user |
logical. Run function using interactive mode (prompts user for
parameter values). Default is |
string |
character. Text string for label. Default |
level |
integer vector. Defines the numerical values to be appended to the character string. Can be any sequence of numbers (see examples). |
digits |
numerical. Default is |
When the function is called with user = TRUE, a sequence of
numbers is generated between the starting and ending number provided by the
user. When user = FALSE, a vector of custom numbers can be provided.
See example below.
data.frame with text labels in the first column, along with string and numeric values in two additional columns.
## sequential string of numbers in label
Labels <- uniqID_maker(string = "string", level = c(1:5), digits = 2)
Labels
## can also use nonsequential strings in input for levels
level <- c(1:5, 8:10, 999:1000)
Labels <- uniqID_maker(string = "string", level = level, digits = 4)
Labels
if(interactive()){
## function using user prompt does not use any of the other parameters
Labels <- uniqID_maker(user = TRUE)
Labels
}