check_list: Check List

View source: R/list.R

check_listR Documentation

Check List

Description

Checks whether an object is a list and optionally the names and values of its elements.

Usage

check_list(
  x,
  values = NULL,
  length = NA,
  unique = FALSE,
  named = NA,
  exclusive = FALSE,
  order = FALSE,
  x_name = substitute(x),
  error = TRUE
)

Arguments

x

The object to check.

values

NULL (default) or a character vector specifying the column names or a named list specifying the column names and values.

length

A flag indicating whether x should have elements (versus no elements) or a missing value indicating no requirements or a count or count range of the number of elements or a count vector of the permitted number of elements.

unique

A flag indicating whether the values must be unique.

named

A flag indicating whether the list must be named or unnamed or a regular expression that must match all the names or count or count range of the number of characters in the names or NA if it doesn't matter if the list is named.

exclusive

A flag indicating whether other elements are not permitted.

order

A flag indicating whether the elements have to occur in the same order as values.

x_name

A string of the name of the object x.

error

A flag indicating whether to throw an informative error or immediately generate an informative message if the check fails.

Value

An invisible copy of x (if it doesn't throw an error).

See Also

check_length and check_unique

Examples

check_list(list())
check_list(list(x1 = 2, x2 = 1:2), values = list(x1 = 1, x2 = 1L))

poissonconsulting/checkr documentation built on Oct. 18, 2023, 9:39 p.m.