Skip to contents

Helper to verify that an object is a list (but not a data.frame) and that all its elements have non-empty names.

Usage

is_named_list(x)

Arguments

x

Any object.

Value

Logical.

Examples

if (FALSE) { # \dontrun{
# Valid named list
is_named_list(list(a = 1, b = 2)) # TRUE

# Invalid: contains unnamed elements
is_named_list(list(a = 1, 2))      # FALSE

# Invalid: data.frame (technically a list, but we want a record/dict)
is_named_list(data.frame(a = 1))  # FALSE
} # }