remove_adjacent_numbered_suffixes {FAIRmaterials} | R Documentation |
Remove Adjacent Numbered Suffixes
Description
This function identifies and removes adjacent numbered suffixes from a character vector. If any strings in the vector have adjacent numerical suffixes, they are replaced with the base string without the numerical suffix.
Usage
remove_adjacent_numbered_suffixes(vec)
Arguments
vec |
A character vector containing strings. The strings may end with numbers. |
Value
A character vector with the same elements as the input, but with adjacent numbered suffixes removed as described.
Examples
template_fill <- c("item1", "item5", "item2", "item3", "item4", "item", "item100",
"product1", "product2", "product3", "product", "product11", "j8j", "j9j")
result <- remove_adjacent_numbered_suffixes(template_fill)
print(result)
# "item", "item", "item", "item", "item", "item", "item100", "product",
# "product", "product", "product", "product11", "j8j", "j9j"
[Package FAIRmaterials version 0.4.1 Index]