| arg_unique | R Documentation |
Checks whether an argument contains only unique values.
arg_unique(x, ..., .arg = rlang::caller_arg(x), .msg = NULL, .call)
x |
the argument to be checked |
... |
further argument passed to |
.arg |
the name of the argument supplied to |
.msg |
an optional alternative message to display if an error is thrown instead of the default message. |
.call |
the execution environment of a currently running function, e.g. |
Returns NULL invisibly if an error is not thrown.
anyDuplicated()
f <- function(z) {
arg_unique(z)
}
try(f(1:3)) # No error
try(f(NULL)) # No error for NULL
try(f(c(1, 1))) # Error: repeated values
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.