Skip to content

Make Character Vectors Unique

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

selkamand/makeunique

Repository files navigation

makeunique

Lifecycle: stable CRAN status R-CMD-check Code Size Codecov test coverage Download Stats Downloads Grand Total

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

About

Make Character Vectors Unique

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Languages