Check to see if a list has names; also check to enforce that all names are present and unique
IsNamedList(x, all.unique = TRUE, allow.empty = FALSE, pass.zero = FALSE)
A list
Require that all names are unique from one another
Allow empty (nchar = 0
) names
Pass on zero-length lists
TRUE
if ..., otherwise FALSE
IsNamedList(list())
#> [1] FALSE
IsNamedList(list(), pass.zero = TRUE)
#> [1] TRUE
IsNamedList(list(1, 2, 3))
#> [1] FALSE
IsNamedList(list(a = 1, b = 2, c = 3))
#> [1] TRUE
IsNamedList(list(a = 1, 2, c = 3))
#> [1] FALSE
IsNamedList(list(a = 1, 2, c = 3), allow.empty = TRUE)
#> [1] TRUE
IsNamedList(list(a = 1, a = 2, a = 3))
#> [1] FALSE
IsNamedList(list(a = 1, a = 2, a = 3), all.unique = FALSE)
#> [1] TRUE