
Create unique labels for tags by combining specified columns
Source:R/fun_auxiliary.r
atl_tag_labs.Rd
Generates a named character vector of unique labels for each tag
in the
data. The labels are created by concatenating the values of specified columns
for the first occurrence of each tag, using a user-defined separator.
Value
A named character vector where the names are unique tag
values
from the data, and the values are concatenated labels created from the
specified columns.
Details
The function selects the first row for each unique tag
to create the
label. If the tag
column or any of the specified columns are missing,
the function will stop with an informative error message.
Examples
library(data.table)
data <- data.table(
tag = c("1234", "2222", "1234"),
rings = c(123234442, 334234234, 123234442),
name = c("Allert", "Peter", "Karl")
)
atl_tag_labs(data, c("rings", "name"), sep = " ")
#> 1234 2222
#> "123234442 Allert" "334234234 Peter"