Description Usage Arguments Value Examples
Since R supports duplicate list names or empty list names, this function is handy for any verification of hash-like names: that is, none must be empty, and they must all be distinct.
1 2 | names_are_unique_and_non_empty(obj, what = "", error = FALSE,
character.only = FALSE)
|
obj |
any R object that has |
what |
character. A description to use when |
error |
logical. Whether or not to error if the names of the |
character.only |
logical. Whether or not to call |
If error = TRUE
, an error will be thrown if all the names
of the obj
are not non-empty and unique. Otherwise, TRUE
or FALSE
will be returned according as the names supplied are
unique and non-empty.
1 2 3 4 | stopifnot(names_are_unique_and_non_empty(c()))
stopifnot(names_are_unique_and_non_empty(list(a = 1, b = 2)))
stopifnot(!names_are_unique_and_non_empty(c("")))
stopifnot(!names_are_unique_and_non_empty(list(a = 1, a = 2)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.