Make Character Strings Unique

Make all elements of a character vector unique. Differs from 'make.unique' by starting at 1 and allowing users to customise suffix format.


makeunique

Lifecycle:experimental CRANstatus R-CMD-check Codecov testcoverage

R package for making all elements of a vector unique. Differs from ‘make.unique’ by starting at 1 and allowing users to customise suffix format.

Installation

Install from cran

install.packages('makeunique')

Install the development version of from github:

# install.packages('remotes')
remotes::install_github('selkamand/makeunique')

Usage

library(makeunique)

make_unique(c('Bob', 'Bob', 'Bob', 'Billy', 'Billy', 'Sven'))
#> [1] "Bob (1)"   "Bob (2)"   "Bob (3)"   "Billy (1)" "Billy (2)" "Sven"

make_unique(c('Bob', 'Bob', 'Bob', 'Billy', 'Billy', 'Sven'), sep = '-', wrap_in_brackets = FALSE)
#> [1] "Bob-1"   "Bob-2"   "Bob-3"   "Billy-1" "Billy-2" "Sven"

Acknowledgements

Inspired heavily by the answers in the following thread

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("makeunique")

1.0.0 by Sam El-Kamand, 4 years ago


https://github.com/selkamand/makeunique


Report a bug at https://github.com/selkamand/makeunique/issues


Browse source code at https://github.com/cran/makeunique


Authors: Sam El-Kamand [aut, cre, cph]


Documentation:   PDF Manual  


MIT + file LICENSE license


Suggests covr, knitr, rmarkdown, testthat


See at CRAN