Description Usage Arguments Examples
Test if vector unique.
1 | is.unique(x)
|
x |
vector |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | suppressPackageStartupMessages(library(dwtools))
x1 <- c("a","b","c","d","e")
x2 <- c(x1,"d")
is.unique(x1)
is.unique(x2)
# my previous approach
is.unq <- function(x) length(x)==length(unique(x))
x <- sample(1e2, 1e7, TRUE) # non-unq
system.time(is.unq(x))
system.time(is.unique(x))
x <- sample(1e7, 1e7, FALSE) # unq
system.time(is.unq(x))
system.time(is.unique(x))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.