str_uniquify: Make strings unique

View source: R/strings.R

str_uniquifyR Documentation

Make strings unique

Description

Make strings unique by adding a suffix to indicate which number copy it is.

Usage

str_uniquify(string, suffix = " (%d)", pad = F)

Arguments

string

(chr vector) A character vector.

suffix

(chr vector) A character to use to make unique suffixes. Must contain ⁠%d⁠.

pad

Whether to pad numbers by adding 0's in front to keep the same length in all suffixes.

Examples

str_uniquify(letters[rep(1, 3)])
str_uniquify(letters[rep(1, 3)], suffix = ', %d')

Deleetdk/kirkegaard documentation built on April 1, 2024, 2:23 a.m.