is_uniq(1:10)
is_uniq(c(1,1,2,3), c(1,2,2,3))
if (FALSE) {
# returns FALSE where a "5" appears
is_uniq(c(1:10, 5))
}
library(magrittr)
if (FALSE) {
# this fails 4 times
mtcars %>% assert(is_uniq, qsec)
}
# to use the version of this function that allows NAs in `assert`,
# you can use a lambda/anonymous function like so:
mtcars %>%
assert(function(x){is_uniq(x, allow.na=TRUE)}, qsec)
Run the code above in your browser using DataLab