Skip to contents

Make Duplicated Character Strings Unique

adds ".1", ".2", etc. to duplicate values

Usage

makeUnique(x, warn = TRUE, sep = ".", simple = FALSE)

Arguments

x

vector of character strings

warn

if TRUE (default) a warning showing the duplicated values is given

sep

separator between name and suffix number. Default: "."

simple

if TRUE all elements with identical name (e.g. "a") are numbered (e.g. "a.1", "a.2", "a.3"), otherwise the first element is kept unchanged and all but the first one are numbered (e.g. "a", "a.1", "a.2"). The default is FALSE.

Value

x with duplicate elements being modified to "element.1", "element.2", etc.