This function helps you create strings that can be used as identifiers.
Arguments
- x
vector of objects for which to create identifiers
- base_name
base string to which the hexadecimal suffixes are to be appended. By default the name of the object
x
, with "s" at the end removed, is used. For example, passing a vector called "files" to this function results in ids "file_01", "file_02", ...
Examples
# Create ids for 32 numbers
createIdAlong(1:32, "number")
#> [1] "number_01" "number_02" "number_03" "number_04" "number_05" "number_06"
#> [7] "number_07" "number_08" "number_09" "number_0a" "number_0b" "number_0c"
#> [13] "number_0d" "number_0e" "number_0f" "number_10" "number_11" "number_12"
#> [19] "number_13" "number_14" "number_15" "number_16" "number_17" "number_18"
#> [25] "number_19" "number_1a" "number_1b" "number_1c" "number_1d" "number_1e"
#> [31] "number_1f" "number_20"
# Take base name from x, with the plural's "s" removed
numbers <- 1:32
createIdAlong(numbers)
#> [1] "number_01" "number_02" "number_03" "number_04" "number_05" "number_06"
#> [7] "number_07" "number_08" "number_09" "number_0a" "number_0b" "number_0c"
#> [13] "number_0d" "number_0e" "number_0f" "number_10" "number_11" "number_12"
#> [19] "number_13" "number_14" "number_15" "number_16" "number_17" "number_18"
#> [25] "number_19" "number_1a" "number_1b" "number_1c" "number_1d" "number_1e"
#> [31] "number_1f" "number_20"