Description Usage Arguments Value Author(s) See Also Examples
Similar to make.unique
, ensure that all elements in x
are unique. Note that duplicate can mean any number of repetitions, not just 2.
This differs from make.unique
in that all instances of a duplicated
element are tagged with a numeric suffix, as opposed to the 2:n elements that get
tagged by make.unique
. see examples
1 | unduplicate(x, sep = ".")
|
x |
a character vector |
sep |
the seperator between |
a character vector, length(x)
, where all elements are unique
Mark Cowley, 2012-05-02
1 2 3 4 5 6 7 8 9 10 | x <- c("a","a","a","b","b")
unduplicate(x)
# [1] "a.1" "a.2" "a.3" "b.1" "b.2"
# compared to make.unique where the first 'a' and 'b' are unchanged.
make.unique(x)
# [1] "a" "a.1" "a.2" "b" "b.1"
unduplicate(letters[1:6])
# [1] "a" "b" "c" "d" "e" "f"
unduplicate(c(x,NA, NA, NA))
# [1] "a.1" "a.2" "a.3" "b.1" "b.2" NA NA NA
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.