
Is an Element of a List of Lists/Classes Fulfilling a Condition?
Source:R/assertions.R
assert_list_element.Rd
Checks if the elements of a list of named lists/classes fulfill a certain condition. If not, an error is issued and all elements of the list not fulfilling the condition are listed.
Arguments
- list
A list to be checked
A list of named lists or classes is expected.
- element
The name of an element of the lists/classes
A character scalar is expected.
- condition
Condition to be fulfilled
The condition is evaluated for each element of the list. The element of the lists/classes can be referred to by its name, e.g.,
censor == 0
to check thecensor
field of a class.- message_text
Text to be displayed in the message
The text should describe the condition to be fulfilled, e.g., "For events the censor values must be zero.".
- ...
Objects required to evaluate the condition
If the condition contains objects apart from the element, they have to be passed to the function. See the second example below.
See also
Checks for valid input and returns warning or errors messages:
assert_atomic_vector()
,
assert_character_scalar()
,
assert_character_vector()
,
assert_data_frame()
,
assert_date_vector()
,
assert_expr_list()
,
assert_expr()
,
assert_filter_cond()
,
assert_function_param()
,
assert_integer_scalar()
,
assert_list_of()
,
assert_logical_scalar()
,
assert_named()
,
assert_numeric_vector()
,
assert_one_to_one()
,
assert_param_does_not_exist()
,
assert_s3_class()
,
assert_same_type()
,
assert_symbol()
,
assert_unit()
,
assert_vars()
,
assert_varval_list()