make.unique(names, sep=".")
names
and containing unique strings.
This function emulates the R function
make.unique. It is used by functions in the
pkgutils library.
If character vector A is already unique, then
make.unique(c(A, B)) preserves A.
This version is probably not fast enough to make unique row names for large data frames.
make.unique(c("a", "a", "a", "a"))
# "a" "a.1" "a.2" "a.3"
make.unique(c("a", "a", "a", "a.1"))
# "a" "a.2" "a.3" "a.1"
make.unique(c(make.unique(c("a", "a", "a")), "a"))
# "a" "a.1" "a.2" "a.3"
# unique vector A is not changed
A <- c("a","b","c")
B <- c("b","c","d")
make.unique(c(A,B))
# "a" "b" "c" "b.1" "c.1" "d"