Skip to contents

Leaves entries untouched if they are already unique; adds a suffix like '_1', etc. if necessary.

Usage

make_unique(x, sep = "_")

Arguments

x

A character vector or something coerceable to a character vector.

sep

Separator between label and suffix. Default: _.

Examples

make_unique(LETTERS[c(1,1,2,2,2,3,4)])
#> [1] "A_1" "A_2" "B_1" "B_2" "B_3" "C"   "D"